8 years ago
A tags
file must have been previously created with ctags
passing --extra=+f
.
The dictionary maps the suffix of the current file to a list of candidate suffixes for alternate files.
The snippet below supports C/C++, but you may extend it to other file types: just update the dictionary accordingly.
nnoremap <leader>a :<c-u>tjump /^<c-r>=expand("%:t:r")<cr>\.\(<c-r>=join(get( \ { \ 'c': ['h'], \ 'cpp': ['h','hpp'], \ 'h': ['c','cpp'], \ 'hpp': ['cpp'] \ }, \ expand("%:e"), ['UNKNOWN EXTENSION']), '\\\|')<cr>\)$<cr>
Lifepillar 8 years ago
Tip: adding
'vim': ['vim']
to the dictionary allows you to easily switch between the different.vim
files of a given plugin (say, fromplugin/foo.vim
toautoload/foo.vim
tosyntax/foo.vim
).