DEV Community

Cover image for VS Code Tip of the Week: Keyboard Shortcuts for Moving Focus
Nick Taylor for VS Code Tips

Posted on • Updated on • Originally published at


VS Code Tip of the Week: Keyboard Shortcuts for Moving Focus

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"
Enter fullscreen mode Exit fullscreen mode

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)

rafi993 profile image

This is awesome. I usually set terminal to open in editor area so that it opens as a tab

"terminal.integrated.defaultLocation": "editor"
Enter fullscreen mode Exit fullscreen mode
sammerro profile image
Michał Kowalski

Surely something they did not think through. Always had to grab a mouse to do this. Until now. Thanks!

nickytonline profile image
Nick Taylor

Stephen Colbert saying Welcome to the Nerd Zone my friend

waylonwalker profile image
Waylon Walker • Edited

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.

50 CLI Tools You Can't Live Without

The top 50 must-have CLI tools, including some scripts to help you automate the installation and updating of these tools on various systems/distros.