Tweak <cfile>

This commit is contained in:
Tim Pope 2015-06-25 10:17:58 -04:00
parent cb3c270c99
commit 1f478e401a

View File

@ -1340,17 +1340,17 @@ function! fireplace#cfile() abort
let file = expand('<cfile>') let file = expand('<cfile>')
if file =~# '^\w[[:alnum:]_/]*$' && if file =~# '^\w[[:alnum:]_/]*$' &&
\ synIDattr(synID(line("."),col("."),1),"name") =~# 'String' \ synIDattr(synID(line("."),col("."),1),"name") =~# 'String'
let file = substitute(expand('%:p'), '[^\/:]*$', '', '').a:file.'.'.expand('%:e') let file = substitute(expand('%:p'), '[^\/:]*$', '', '').a:file
elseif file =~# '^[^/]*/[^/.]*$' && file =~# '^\k\+$' elseif file =~# '^[^/]*/[^/.]*$' && file =~# '^\k\+$'
let [file, jump] = split(file, "/") let [file, jump] = split(file, "/")
if file !~# '\.' if file !~# '\.'
try try
let file = tr(fireplace#evalparse('((ns-aliases *ns*) '.s:qsym(file).' '.s:qsym(file).')'), '.', '/') let file = tr(fireplace#evalparse('((ns-aliases *ns*) '.s:qsym(file).' '.s:qsym(file).')'), '.-', '/_')
catch /^Clojure:/ catch /^Clojure:/
endtry endtry
endif endif
elseif file =~# '^\w[[:alnum:]-]\+\.[[:alnum:].-]\+$' elseif file =~# '^\w[[:alnum:]-]\+\.[[:alnum:].-]\+$'
let file = tr(file, '.', '/') let file = tr(file, '.-', '/_')
endif endif
if exists('jump') if exists('jump')
return '+sil!dj\ ' . jump . ' ' . fnameescape(file) return '+sil!dj\ ' . jump . ' ' . fnameescape(file)