Say somewhere in my Vim buffer that I have the following:
function foo() {
return 'funday, funky, funnel cake';
}
Now I want to create a new function below this..
I start typing fun and hit Tab to bring up my autocomplete menu.
In that menu, I get (in this hypothetical order):
funday
funnel
function
funky
Normally, I would Ctrl + n twice to highlight function, which isn’t a big deal.. but what if I have 20 results and I want to get to the 10th result really fast.
Is there any known way (or plugin) to quickly jump to specific values in a Vim autocomplete menu?
Update:
Using a hack, I found a way to jump by X autocomplete options:
" j/k for up and down in autocomplete menu
inoremap <expr> j ((pumvisible())?("\<C-n>"):("j"))
inoremap <expr> k ((pumvisible())?("\<C-p>"):("k"))
" Hack to jump down x positions
inoremap <expr> 2 ((pumvisible())?("\<C-n><C-n>"):("2"))
inoremap <expr> 3 ((pumvisible())?("\<C-n><C-n><C-n>"):("3"))
inoremap <expr> 4 ((pumvisible())?("\<C-n><C-n><C-n><C-n>"):("4"))
However, my vimscript is gross. Anyone got a better way to do this?
maybe you are interested in neocomplcache plugin