This week's tip of the week is all about configuring some shortcuts that allow you to move focus between the editor and the integrated terminal.
By default, CTRL + ` toggles the integrated terminal. I use this all the time.
I struggled with moving back and forth between the terminal and the current tab in the editor. Toggling the terminal closes the terminal panel, and focus is brought back to the current tab in the editor, but what if you want to toggle between the two without closing the integrated terminal panel?
Thanks to this post on Stackoverflow, I was well on my way to achieving this.
The only problem with this solution was it hijacked how the original intergrated terminal toggle worked with CTRL + `.
No problem, just add another keyboard shortcut! What I ended up with was the following for my keyboard shortcuts.
{
...
// Toggle between terminal and editor focus
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus" },
{
"key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
// Toggle integrated terminal panel
{
"key": "ctrl+escape",
"command": "workbench.action.terminal.toggleTerminal"
}
}
So now, toggling between the editor and integrated terminal can be done using CTRL + ` and if I want to close the integrated terminal panel, I use CTRL + ESC.
If you're new to modifying keyboard shortcuts, check out the VS Code official documentation.
Happy VS Coding!
Top comments (4)
This is awesome. I usually set terminal to open in editor area so that it opens as a tab code.visualstudio.com/updates/v1_5...
Surely something they did not think through. Always had to grab a mouse to do this. Until now. Thanks!
Love a good keyboard shortcut, while I was in vscode I liked using alt+j and alt+k to make it feel like my tmux setup.
Keyboard Driven VSCode
Waylon Walker ・ Nov 19 '19 ・ 4 min read