Software Developer
There is no official shortcut assigned in VS code to change the focus between the terminal and the editor, but thanks to the customization options in VS Code you can create a shortcut of your own.
Make sure the shortcut which you’re assigning is not being used by VS Code natively or by any external extensions you have installed. Overwriting of pre-assigned or native shortcuts might lead to breaking the combination.
In VS Code go to File > Preferences > Keyboard Shortcuts
From the top right corner select Open Keyboard Shortcuts (JSON) option
In the keybindings.json file paste the following code inside the square brackets [ ] :
{
"key": "ctrl+k",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+k",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
[
{
"key": "ctrl+k",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+k",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
]
You can now finally use the key combination assigned (here ctrl+k) to change focus between your terminal and your editor or even open a new terminal in case one is not already opened in VS Code.