Right now I am working on a file which uses many classes, methods, functions, variables, etc. Is it possible to go to the declaration of all of them? Please, take into account t
I use the you complete me (ycm) plugin for this, which is
a fast, as-you-type, fuzzy-search code completion engine for Vim
It works with a bunch of languages and is very powerful. Check this section for how to install it on your system.
When e.g. using it with a Java Maven project, open the desired file from the folder that contains your pom.xml
file and the plugin scans all your files and dependencies.
I do have the following key mappings in my ~/.vimrc
for convenient use of your requested feature:
let g:ycm_key_list_select_completion = ['', '']
let g:ycm_key_list_previous_completion = ['', '']
let g:SuperTabDefaultCompletionType = ''
nnoremap jd :YcmCompleter GoToDefinitionElseDeclaration
nnoremap ji :YcmCompleter GoToImplementation
nnoremap jr :YcmCompleter GoToReferences
Assuming your
is mapped to ,
with let mapleader = ","
as in my case the following commands work:
,jd
go to definition or declaration,ji
go to implementation,jr
go to referencesCtrl+n
/Ctrl+p
move down/up in a list that pops up for autocompletion