I finally got Visual Studio Code’s terminal and tab handling working the way I wanted, with these keybindings:
[
{
"key": "shift+cmd+]",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "shift+cmd+[",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
},
{
"key": "cmd+w",
"command": "workbench.action.terminal.kill",
"when": "terminalFocus"
},
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
}
]
This way, cmd+shift+]
and cmd+shift+[
not only allow you to switch between editor tabs, but also terminals, when the terminal is focused. cmd+w
kills the current terminal tab as expected. ctrl+`
switches focus between the editor and the terminal.
I was considering overriding cmd+t
to open a new terminal when the terminal is focused, but decided to just get used to the built in ctrl+shift+`
shortcut instead.