Reputation: 263
all. I am trying to use youcompleteme for code completing in vim. Generally, it works well except that when i need to jump between source files. First. I use the subcommand
:YcmCompleter GoToDefinition
it can find the definition. BUT it seems so verbose. Then I want to map this subcommand into some shortcut key according to the YCM's instruction:
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
I am a little confused. what is short cut key? l or gl ?
Upvotes: 11
Views: 12323
Reputation: 114
You can type \gl
to go to the definition. The default <leader>
is the key \
. So if you type \gl
, you can go to the definition.
And another shortcut you can try, Ctrl+o -> you can return back where you came from.
Upvotes: 1
Reputation: 6352
When you create a mapping with <leader>
, <leader>
is replaced by whatever is in your "mapleader" variable (by default \
).
If you have this in your vimrc:
let mapleader=","
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
It acts the same as:
nnoremap ,gl :YcmCompleter GoToDeclaration<CR>
Thus you could run the YcmCompleter GoToDeclaration
command by pressing ,gl
Upvotes: 14