Saurabh Kumar

Navigating VS Code terminals from the keyboard

VS Code’s built-in terminals are hard to move between from the keyboard. These keybindings.json entries fix it, adapted from jbranchaud’s TIL:

  • cmd+[ / cmd+]: previous / next terminal
  • cmd+1 to cmd+5: terminal by position
  • cmd+n: new terminal; cmd+w: kill it
  • cmd+t: toggle between terminal and editor
{ "key": "cmd+]", "command": "workbench.action.terminal.focusNext", "when": "terminalFocus" },
{ "key": "cmd+[", "command": "workbench.action.terminal.focusPrevious", "when": "terminalFocus" },
{ "key": "cmd+1", "command": "workbench.action.terminal.focusAtIndex1", "when": "terminalFocus" },
{ "key": "cmd+2", "command": "workbench.action.terminal.focusAtIndex2", "when": "terminalFocus" },
{ "key": "cmd+3", "command": "workbench.action.terminal.focusAtIndex3", "when": "terminalFocus" },
{ "key": "cmd+4", "command": "workbench.action.terminal.focusAtIndex4", "when": "terminalFocus" },
{ "key": "cmd+5", "command": "workbench.action.terminal.focusAtIndex5", "when": "terminalFocus" },
{ "key": "cmd+n", "command": "workbench.action.terminal.new", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" },
{ "key": "cmd+w", "command": "workbench.action.terminal.kill", "when": "terminalFocus" },
{ "key": "cmd+t", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" },
{ "key": "cmd+t", "command": "workbench.action.terminal.toggleTerminal" }