VS Code - Remap certain arrow key functionality
Asked Answered
T

2

6

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.

Typal answered 14/3, 2019 at 9:27 Comment(3)
Did you find a way to change the keyboard bindings for the "find" panel? I'd like to be able to move the cursor left and right thereNephrotomy
@ProQ Best I got for navigating the find panel is using the 'tab' and 'shift-tab'. You could also bind specific actions in the find panel, if you open the keyboard shortcuts here are some of the actions: imgur.com/a/RbLZolmTypal
I don’t see any keyboard shortcut options for moving the cursor left and right though...Nephrotomy
T
9

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

Typal answered 14/3, 2019 at 20:58 Comment(1)
Is there a way to do this for the problems panel?Antedate
O
0

There are extensions to bind arrow keys to the main keyboard area. Try this one called Mover, which is quite easy.

Overlooker answered 11/5 at 4:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.