Leverage evalparse

This commit is contained in:
Tim Pope 2014-01-12 01:01:08 -05:00
parent a0fde95d2e
commit 9c48439da7

View File

@ -937,7 +937,6 @@ augroup END
" Go to source {{{1 " Go to source {{{1
function! fireplace#source(symbol) abort function! fireplace#source(symbol) abort
let options = {'session': 0}
let cmd = let cmd =
\ '(when-let [v (resolve ' . s:qsym(a:symbol) .')]' . \ '(when-let [v (resolve ' . s:qsym(a:symbol) .')]' .
\ ' (when-let [filepath (:file (meta v))]' . \ ' (when-let [filepath (:file (meta v))]' .
@ -996,23 +995,15 @@ augroup END
" Go to file {{{1 " Go to file {{{1
function! fireplace#findfile(path) abort function! fireplace#findfile(path) abort
let options = {'session': 0}
let path = a:path let path = a:path
if path !~# '[/.]' && path =~# '^\k\+$' if path !~# '[/.]' && path =~# '^\k\+$'
let aliascmd = let path = fireplace#evalparse('((ns-aliases *ns*) '.s:qsym(path).' '.s:qsym(path).')')
\ '(symbol (if-let [ns ((ns-aliases *ns*) '.s:qsym(path).')]' . endif
\ ' (str (.replace (.replace (str (ns-name ns)) "-" "_") "." "/") ".clj")' . if path !~# '/'
\ ' "'.path.'.clj"))' let path = tr(path, '.-', '/_')
let path = get(split(s:eval(aliascmd, options).value, "\n"), 0, '') endif
else if path !~# '\.\w\+$'
if path !~# '/' let path .= '.clj'
let path = tr(path, '.-', '/_')
endif
if path !~# '\.\w\+$'
let path .= '.clj'
endif
endif endif
return fireplace#findresource(path) return fireplace#findresource(path)
endfunction endfunction