Scrolling in vim autocomplete box with jk movement keys

后端 未结 3 1253
情歌与酒
情歌与酒 2020-12-24 07:25

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 throu

相关标签:
3条回答
  • 2020-12-24 08:03
    inoremap <expr> <down> ((pumvisible())?("\<C-n>"):("\<down>"))
    inoremap <expr> <up> ((pumvisible())?("\<C-p>"):("\<up>"))
    
    0 讨论(0)
  • 2020-12-24 08:08

    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.

    0 讨论(0)
  • 2020-12-24 08:10
    inoremap <expr> j ((pumvisible())?("\<C-n>"):("j"))
    inoremap <expr> k ((pumvisible())?("\<C-p>"):("k"))
    
    0 讨论(0)
提交回复
热议问题