How to configure in IdeaVIM Ctrl + N and Ctrl + P completion from Vim?

≡放荡痞女 提交于 2019-12-03 05:33:48

问题


In Vim we can use Ctrl + N or Ctrl + P to finish code completion. How to configure it in IdeaVim for IntelliJ?


回答1:


Alt + / and Alt + Shift + / work both in plain IntelliJ and with IdeaVim installed.

Please see documentation on JetBrains page - it's called Hippie Completion (newer versions call this completion Cyclic Expand Word).

And of course you can always use Ctrl + Space, Ctrl + Shift + Space, Ctrl + Alt + Space.




回答2:


I could not get CTRL-N and CTRL-P to work after mapping them to "Cyclic Expand Word" and "Cyclic Expand Word (Backward)" in IDEA 2016.2.5 (while running IdeaVIM). Both keystrokes just did nothing.

The solution was to additionally select "Settings" from the File Menu, then "Other Settings" -> "Vim Emulation", and set the "Handler" for Ctrl+N and Ctrl+P to "IDE" instead of "Vim".




回答3:


Add the following keymaps: Ctrl+N to Down and Ctrl+P to Up

So you can easily navigate in the completions menus.




回答4:


This is the way I found to make the word completion work with CTRL-N and CTRL-P, while still having the shortcuts work for DOWN and UP in lists.

In Settings -> Keymap, map CTRL-N and CTRL-P to Down and Up respectively. Then, in the Other Settings -> Vim Emulation, set CTRL-N and CTRL-P handlers to Vim.

Finally, add the following to your .ideavimrc

imap <C-n> <ESC>:action HippieCompletion<CR>a
imap <C-p> <ESC>:action HippieBackwardCompletion<CR>a



回答5:


File->Settings->Keymap->search keywords "cyclic expand word"



来源:https://stackoverflow.com/questions/30149091/how-to-configure-in-ideavim-ctrl-n-and-ctrl-p-completion-from-vim

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!