Scrolling in vim autocomplete box with jk movement keys
In vim you can start typing a word, hit ctrl-n, and a box will popup with suggested completions. I don't like having to move my 开发者_开发知识库hands away to the arrow keys to scroll through this list. Is there some way I can use the jk keys to scroll down/up instead?
I know the question is asking to use the J and K keys but you can also avoid using the arrow keys another way.
After hitting ctrl+n to get the autocomplete popup, you can navigate the list with ctrl+n and ctrl+p.
inoremap <expr> j ((pumvisible())?("\<C-n>"):("j"))
inoremap <expr> k ((pumvisible())?("\<C-p>"):("k"))
inoremap <expr> <down> ((pumvisible())?("\<C-n>"):("\<down>"))
inoremap <expr> <up> ((pumvisible())?("\<C-p>"):("\<up>"))
精彩评论