Switch focus between editor and integrated terminal in Visual Studio Code

While there are a lot of modal toggles and navigation shortcuts for VS Code, there isn't one specifically for "move from editor to terminal, and back again". However you can compose the two steps by overloading the key and using the when clause.

Open the keybindings.json from the editor: CMD-SHIFT-P -> Preferences: Open Keyboard Shortcuts File and add these entries:

// Toggle between terminal and editor focus
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"},
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}

With these shortcuts I will focus between the editor and the Integrated Terminal using the same keystroke.


ctrl+` : To Focus on Integrated Terminal

ctrl+1 : To Focus on Editor (If editor-2 command would be ctrl+2)

enter image description here

More Info : https://www.rscoder.com/2020/11/14/how-to-switch-focus-between-editor-and-integrated-terminal-in-visual-studio-code/