Use C-n/C-p in VsVim to select completion candidate in intellisense popup
Asked Answered
B

1

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.

Boyla answered 31/7, 2013 at 19:59 Comment(2)
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 github.com/jaredpar/VsVim/issues/1149Terrorstricken
Here is the issue that tracks getting Alt key binding support github.com/jaredpar/VsVim/issues/806Terrorstricken
I
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.

Invitation answered 1/3, 2015 at 22:50 Comment(2)
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?Dyal
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.Invitation

© 2022 - 2024 — McMap. All rights reserved.