Search code examples
visual-studio-codevscode-keybinding

How can I make easier-to-reach shortcuts for arrow keys in VS Code?


Alternate of arrow keys in VS Code? especially the right arrow key to move outside the double quotes without moving hand towards arrow keys.

I just want to know if there is already a shortcut available instead of key map manually.


Solution

  • You could probably use something like this in your keybindings.json (open with Preferences: Open Keyboard Shortcuts (JSON) in the command palette):

    {
        "key": "alt+w",
        "command": "cursorUp",
        "when": "textInputFocus",
    },
    {
        "key": "alt+shift+w",
        "command": "cursorUpSelect",
        "when": "textInputFocus",
    },
    {
        "key": "alt+a",
        "command": "cursorLeft",
        "when": "textInputFocus",
    },
    {
        "key": "ctrl+alt+a",
        "command": "cursorWordLeft",
        "when": "textInputFocus",
    },
    {
        "key": "alt+shift+a",
        "command": "cursorLeftSelect",
        "when": "textInputFocus",
    },
    {
        "key": "ctrl+shift+alt+a",
        "command": "cursorWordLeftSelect",
        "when": "textInputFocus",
    },
    {
        "key": "alt+s",
        "command": "cursorDown",
        "when": "textInputFocus",
    },
    {
        "key": "alt+shift+s",
        "command": "cursorDownSelect",
        "when": "textInputFocus",
    },
    {
        "key": "alt+d",
        "command": "cursorRight",
        "when": "textInputFocus",
    },
    {
        "key": "ctrl+alt+d",
        "command": "cursorWordRight",
        "when": "textInputFocus",
    },
    {
        "key": "alt+shift+d",
        "command": "cursorRightSelect",
        "when": "textInputFocus",
    },
    {
        "key": "ctrl+shift+alt+d",
        "command": "cursorWordRightSelect",
        "when": "textInputFocus",
    },
    

    But I just remap my keys closer to the system level using AutoHotKey on Windows and xkbd on Ubuntu, which is nice because then it applies to almost all my applications.