Keybindings and the command palette

Run any command from the command palette, record your own shortcuts, edit keybindings.json and turn on Vim keys.

The command palette

Press ⇧⌘P to find any command by name, with its shortcut beside it.

⇧⌘P, or View → Command Palette…, opens the command palette. Type to search every command.

  • Matched letters are highlighted, and results are grouped by section.
  • Toggle commands show whether they’re on or off.
  • Each result shows its shortcut, if it has one.
  • A command you can’t use right now stays listed, marked Unavailable now, so you always know it exists.
  • ↑ and ↓ move, ↵ runs, and esc closes.

The palette also switches themes: type a theme’s name.

Commands lists every command, and Keyboard shortcuts lists every default shortcut.

Change a shortcut

Rebind any command in Settings → Keybindings by pressing the keys you want.

Settings → Keybindings lists every command with its Keybinding, When it applies (anywhere, or only in the editor or the output), and its Source: Default, User for one you set, or Not bound. Search the list to find a command.

  1. Click Change on a command’s row.
  2. Press the keys you want. Press Escape to cancel.
  3. The new shortcut applies straight away.

Recording follows a few rules:

  • A shortcut needs a modifier, such as ⌘, ⌃ or ⌥, unless it’s a function key.
  • A few keys are reserved and can’t be used.
  • When another command already answers to the chord, JSLab warns you and names it: Also bound to that command.

Reset returns one command to its default shortcut, and Reset All Keybindings returns the whole keymap.

Changes apply to the running app at once, including the shortcuts shown in the menu bar, with no relaunch.

Edit keybindings.json

Your changes are saved in keybindings.json in JSLab’s data folder, and you can edit it by hand. Open keybindings.json in Settings → Keybindings opens it.

The file is a list of rules applied on top of the defaults, in file order. Each rule names a key and a command id:

[
  { "key": "cmd+alt+n", "command": "run.start" },
  { "key": "cmd+k", "command": "-output.clear" }
]

The first rule adds ⌥⌘N for Run. The second removes Clear Output’s default ⌘K: a - before the command id removes that binding instead of adding one.

Vim keys

Turn on Vim keys to edit with modes and motions; the status bar shows the current mode.

Turn on Vim Keys in Settings → Editor to edit with Vim key bindings. ⌘R still runs your code in every mode.

Last updated