Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Moving up and down inside an auto-completion box through Vim keys (j and k) instead of arrow keys.

Open DevotionGeo opened this issue 6 years ago • 13 comments

FEATURE REQUEST: A feature which will make life inside the editor, of every VSCodeVim user, 100 times easier!

What happens: When we start typing some letters and intellisense opens the auto-completion box, if the choices are more than one and our required option isn't under selection, we have either to type more letters to filter further and have our required member selected or press arrow keys to choose the required member manually and then press tab to insert it. Sometimes we even lose the choice of typing more characters to further filter. This kind of situation occurs in cases when we have a snippet and we have already completed the prefix for that snippet. For example the following snapshot. 01a

In the example above I have already completed typing the prefix (la) for an embedded elixir snippet, but as another member (Emmet Abbreviation for label tag) is above the required member, so I have to press the down arrow key to choose the required member.

(Important) Now if I press Escape key, it will discard the auto-completion options altogether and will take the editor (from the insert mode) to the normal mode. 02

What do I wish to happen: I wish that inside the auto-completion box, while being in the above situation (more than one members, and the required member isn't under selection), if I press Escape key, the editor don't go back to the normal mode, but it temporarily map j and k keys to to down and up arrow keys respectively, until I get out of the auto-completion box by either pressing tab to insert a member, or press Escape again to get out of the auto-completion box myself.

Thank You so much for this awesome plugin!

DevotionGeo avatar Feb 13 '18 20:02 DevotionGeo

I'm a bit confused what the purpose of this would be. Do you not want to use down and up?

If so, you can use Ctrl n and Ctrl p.

Chillee avatar Feb 13 '18 20:02 Chillee

@Chillee , let me update the title to make it clearer.

DevotionGeo avatar Feb 13 '18 20:02 DevotionGeo

@Chillee I didn't know about Ctrl n and Ctrl p, which are handy. Thank you for that! But I'd still want to have the option I proposed. It will make the editor a paradise for VSCodeVim users, because moving up and down through j and k is such a luxury!

DevotionGeo avatar Feb 13 '18 20:02 DevotionGeo

Ctrl n and Ctrl p is standard in vim (next prev). This would break that paradigm.

IanEdington avatar Feb 13 '18 20:02 IanEdington

@IanEdington But we are only adding an extra option, we'are not removing Ctrl n and Ctrl p if someone wants to use that instead. Everyone with VIM emulators inside Sublime/Atom/VSCode mixes commands. For example I sometimes save a file with Ctrl s, and sometimes save it with Escape -> :w -> Enter (the Vim way).

Thank You for the response!

DevotionGeo avatar Feb 13 '18 22:02 DevotionGeo

@DevotionGeo TBH, it's unlikely that we'll add this feature. It seems very niche. However, if it attracts enough attention at some point, it may be worth considering.

Chillee avatar Feb 14 '18 00:02 Chillee

@Chillee It's OK. I'd have to practice Ctrl n and Ctrl p more. :)

DevotionGeo avatar Feb 14 '18 01:02 DevotionGeo

Ctrl n and ctrl p are great for that autocomplete. Is there way to select different function signatures too?
image

insominx avatar Mar 28 '18 20:03 insominx

There's a bunch of vim-plugins (e.g.: ctrl-p) and external-programs like FZF that already use <c-j>/<c-k>.

Why shouldn't this be customizeable? How would supporting <c-j>/<c-k> next to <c-n>/<c-p> "break that paradigm"? When it's exactly what e.g. FZF does?

Bump.

davidnorthetal avatar Jun 12 '18 12:06 davidnorthetal

@davidnorthetal Nothing wrong with mapping <c-j>/<c-k> to up/down. OP was proposing that within autocomplete, you could press escape, and then use j/k to navigate up and down.

@insominx Not currently. It's the command showNextParameterHint, but we don't currently have anything mapped to it. I suppose it would make sense to have it also be mapped to <c-n>/<c-p>. What do you think?

Chillee avatar Jun 12 '18 16:06 Chillee

@Chillee There is precedent for it so it would be consistent with that. Also, good ways to deal with vscode popups or other editor features make the integration that much better. 👍

insominx avatar Jun 12 '18 16:06 insominx

@insominx Unluckily, this is actually kind of tricky to do. <ctrl-p> needs to be bound to 3 different things: the file switcher, going to next autocomplete suggestion, and going to next parameter hint.

The way things are currently set up, this is surprisingly difficult.

Chillee avatar Jun 12 '18 17:06 Chillee

I'm a bit confused what the purpose of this would be. Do you not want to use down and up?

If so, you can use Ctrl n and Ctrl p.

I'm suffering a lot here, this saved it. Very counter-intuitive this control N and Control P, if hjkl would be more intuitive.

LeonardoDaLuz avatar Aug 06 '22 16:08 LeonardoDaLuz