7

I would like to use CTRL-P/CTRL-n instead of Up/Down arrows to select the completion candidate. I tried to :imap <C-n> <Down>, but instead of selecting the next completion candidate, the cursor will go down to the next line.

Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
ale
  • 986
  • 1
  • 9
  • 14
  • You can use Ctrl-P / Ctrl-N to navigate the windows that VsVim brings up but not normal intellisense windows. I filed the following bug to try and add that behavior https://github.com/jaredpar/VsVim/issues/1149 – JaredPar Aug 01 '13 at 18:41
  • Here is the issue that tracks getting Alt key binding support https://github.com/jaredpar/VsVim/issues/806 – JaredPar Aug 01 '13 at 18:42

1 Answers1

10

Instead of using a vim key mapping, you can handle this with a Visual Studio keyboard shortcut (Tools > Options > Environment > Keyboard):

enter image description here

The Edit.LineUp and Edit.LineDown commands are what you're looking for. You can see in the image above that I am using Alt+J for Edit.LineDown, but you can use Ctrl+N instead. I prefer using the Alt key instead of the Ctrl key because pressing Ctrl dims out the Intellisense list, while Alt does not. Just a matter of preference though.

I formerly had this same question, and I received the answer here.

Community
  • 1
  • 1
RSW
  • 1,649
  • 1
  • 17
  • 37
  • Did you do anything else with your setup to get this to work? I have VsVim installed and when I'm in edit mode, hit ctrl+space to start Intellisense, when I hit alt+J (after setting up your shortcut), it closes intellisense the second I press alt. When I try it with ctrl+J, it inserts a newline. Is there some vsvim setting I need to change too? – benui Oct 14 '16 at 15:49
  • Hmmm...I don't remember any other changes that I made to get this to work (but my memory does fail me!). I just tested and Alt+J navigates the Intellisense list while Ctrl+J just dims out the Intellisense list. I noticed you said Ctrl+J enters a newline, so I went into Tools > Options > VsVim > Keyboard and changed the option for Ctrl+J to "Handled by VsVim" (I usually have it set to "Handled by Visual Studio"). When I did, I then saw the behavior you are seeing with Ctrl+J entering a newline. Not sure what's causing the Alt key to dismiss the Intellisense list though. – RSW Oct 14 '16 at 17:54