Support gf on relative (load) paths
This doesn't do a file existence check because that's tricky with jar files in the mix. Instead, it's limited to strings, so a gf on a random symbol doesn't send us flying.
This commit is contained in:
parent
a14328c1dc
commit
25e18b5f82
@ -1259,7 +1259,10 @@ function! fireplace#findfile(path) abort
|
||||
endfunction
|
||||
|
||||
function! s:GF(cmd, file) abort
|
||||
if a:file =~# '^[^/]*/[^/.]*$' && a:file =~# '^\k\+$'
|
||||
if a:file =~# '^\w[[:alnum:]_/]*$' &&
|
||||
\ synIDattr(synID(line("."),col("."),1),"name") =~# 'String'
|
||||
let file = substitute(expand('%:p'), '[^\/:]*$', '', '').a:file.'.'.expand('%:e')
|
||||
elseif a:file =~# '^[^/]*/[^/.]*$' && a:file =~# '^\k\+$'
|
||||
let [file, jump] = split(a:file, "/")
|
||||
if file !~# '\.'
|
||||
try
|
||||
@ -1267,10 +1270,10 @@ function! s:GF(cmd, file) abort
|
||||
catch /^Clojure:/
|
||||
endtry
|
||||
endif
|
||||
else
|
||||
let file = a:file
|
||||
endif
|
||||
let file = fireplace#findfile(file)
|
||||
else
|
||||
let file = fireplace#findfile(a:file)
|
||||
endif
|
||||
if file ==# ''
|
||||
let v:errmsg = "Couldn't find file for ".a:file
|
||||
return 'echoerr v:errmsg'
|
||||
|
Loading…
Reference in New Issue
Block a user