3

In VS Code, is there a way to move the cursor x lines up/down in the currently active window or menu? I found a great post showing how it can be done for the text editor window (Microsoft VS Code - Jump 10 lines vertically at once),

{
    "key": "ctrl+up",
    "command": "cursorMove",
    "args": {
        "to": "up",
        "by": "line",
        "value": 10
    },
    "when": "editorTextFocus"
},
{
    "key": "ctrl+down",
    "command": "cursorMove",
    "args": {
        "to": "down",
        "by": "line",
        "value": 10
    },
    "when": "editorTextFocus"
},

but I'm trying to get it to work for any window or menu that is currently active, to make navigating with only the keyboard a little faster, such as in the Explorer window (Ctrl + Shift + E), in the Breadcrumb menu (Ctrl + Shift + .) or in the Quick Open menu (Ctrl + P).

Looking at the VS Code keybindings webpage (https://code.visualstudio.com/docs/getstarted/keybindings), under the 'when' clause contexts section it states "If your key binding doesn't have a when clause, the key binding is globally available at all times.", but when removing the when clause from the custom keybinding, it unfortunately still only seems to work in the text editor window, and not in any other window or menu.

indigoblue
  • 453
  • 6
  • 13

0 Answers0