Leverage evalparse
This commit is contained in:
parent
a0fde95d2e
commit
9c48439da7
@ -937,7 +937,6 @@ augroup END
|
||||
" Go to source {{{1
|
||||
|
||||
function! fireplace#source(symbol) abort
|
||||
let options = {'session': 0}
|
||||
let cmd =
|
||||
\ '(when-let [v (resolve ' . s:qsym(a:symbol) .')]' .
|
||||
\ ' (when-let [filepath (:file (meta v))]' .
|
||||
@ -996,24 +995,16 @@ augroup END
|
||||
" Go to file {{{1
|
||||
|
||||
function! fireplace#findfile(path) abort
|
||||
let options = {'session': 0}
|
||||
|
||||
let path = a:path
|
||||
|
||||
if path !~# '[/.]' && path =~# '^\k\+$'
|
||||
let aliascmd =
|
||||
\ '(symbol (if-let [ns ((ns-aliases *ns*) '.s:qsym(path).')]' .
|
||||
\ ' (str (.replace (.replace (str (ns-name ns)) "-" "_") "." "/") ".clj")' .
|
||||
\ ' "'.path.'.clj"))'
|
||||
let path = get(split(s:eval(aliascmd, options).value, "\n"), 0, '')
|
||||
else
|
||||
let path = fireplace#evalparse('((ns-aliases *ns*) '.s:qsym(path).' '.s:qsym(path).')')
|
||||
endif
|
||||
if path !~# '/'
|
||||
let path = tr(path, '.-', '/_')
|
||||
endif
|
||||
if path !~# '\.\w\+$'
|
||||
let path .= '.clj'
|
||||
endif
|
||||
endif
|
||||
return fireplace#findresource(path)
|
||||
endfunction
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user