Search code examples
keyboard-shortcutsvisual-studio-codevscodevim

VS Code - Remap certain arrow key functionality


I'm using the vs vim extension and would like to move away from arrow keys completely, but certain windows in vs code only allow arrow key navigation.

So instead of having to go up and down the list with arrow keys, I would like to use ctrl + k and ctrl + j and same for expanding and collapsing in a list with ctrl + l and ctrl + h instead of left arrow and right arrow.

Concretely the windows that I haven't gotten to work are:

  • search files pane on the (by default) left hand side the file
  • search that opens on top with (by default) ctrl + p for settings etc
  • the usages window of e.g. a function

What I already tried and didn't work is to remap all the keyboard-shortcuts I found when searching for the arrow keys to j k l h

Any suggestions are much appreciated.


Solution

  • So all the settings that I wanted were in the keyboard shortcuts:

    • the left pane search as well as the usages menu are lists, so in the keybindings you can remap list.expand, list.collapse, list.toggle, list.focusUp, list.focusDown to move around as well as e.g. list.focusFirst to focus the list
    • the top pane is called quickOpen and you can use workbench.action.quickOpenSelectNext and workbench.action.quickOpenSelectPrevious to move up and down
    • bonus: for the code suggestions there is selectPreviousSuggestion and selectNextSuggestion in the settings

    I'll also include a screenshot as a link of the modification I made, because some "when": conditions are important. https://i.sstatic.net/wIUG2.jpg