Created
September 10, 2012 14:47
-
-
Save spiiph/3691241 to your computer and use it in GitHub Desktop.
Some examples using tags to find files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Improved goto file {{{2 | |
" echo the full path of the file name under the cursor | |
nmap <silent> <Leader>gf :call <SID>FindFilesByTag(expand("<cfile>"))<CR> | |
" go to the file name under the cursor | |
nnoremap <expr> gf empty(taglist(fnamemodify(expand('<cfile>'), ":t"))) ? "gf" : ":tj <C-r><C-f><CR>" | |
nnoremap <expr> <C-w>f empty(taglist(fnamemodify(expand('<cfile>'), ":t"))) ? "\<C-w>f" : ":stj <C-r><C-f><CR>" | |
function! s:FindFilesByTag(file) " {{{2 | |
for f in taglist(expand(a:file)) | |
echo f["filename"] | |
endfor | |
endfunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment