Code 12: Create new key-bindings in VSCode via JSON file

A handy keybinding to switch between Terminals in VSCode
coding
vscode
Author

Tony Phung

Published

October 8, 2024

1. How to add a new Key-Binding via VSCode JSON file

1.1 Go to Preferences

  • Go to Preferences or
  • ctrl-shift-p then [**Preferences: Open Keyboard Shortcuts (JSON)**]

1.2 Add entry JSON file

  • The entry is all the code below (including curly brackets).
  • Insert code into the json list already existing in the json file:
    • ie in betweeen the square brackets in the json file.

1.3 Keybinding: [Go to next terminal] - json code

{
    "key": "ctrl+tab",
    "command": "workbench.action.terminal.focusNext",
    "when": "terminalFocus"
}

1.4 Keybinding: [Go to next terminal] - screenshot

1.5 [Bonus] Keybinding: [Kill all terminals] - json code

{
    "key": "ctrl+shift+w",
    "command": "workbench.action.terminal.killAll",
    "when": "terminalHasBeenCreated || terminalIsOpen || terminalProcessSupported"
}

1.6 [Bonus] Keybinding: [Kill all terminals] - screenshot