How to assign keyboard shortcut for arrow keys in Visual Studio Code

27 Views Asked by At

I am using Visual Studio Code and while coding, moving fingers to the arrow keys sometimes feel irritating and breaks rhythm. What I am looking for is a way to bind keyboard shortcuts for moving cursor.

Something like -

  • ctrl + j : moves cursor left

  • ctrl + l : moves cursor right

  • ctrl + i: moves cursor up

  • ctrl + k : moves cursor down

1

There are 1 best solutions below

0
Piyush Singhania On

I solved my problem by following the steps below -

  1. Press Ctrl + p
  2. Type > Preferences: Open Keyboard Shortcuts (JSON) and hit enter
  3. A keybindings.json file should open up
  4. Paste the following properties at the end of the keybindings file, and this should do the trick.
    {
      "key": "ctrl+j",
      "command": "cursorLeft",
      "when": "editorTextFocus"
    },
    {
      "key": "ctrl+k",
      "command": "cursorDown",
      "when": "editorTextFocus"
    },
    {
      "key": "ctrl+l",
      "command": "cursorRight",
      "when": "editorTextFocus"
    },
    {
      "key": "ctrl+i",
      "command": "cursorUp",
      "when": "editorTextFocus"
    }