Refer to this Question/Answers Switch focus between editor and integrated terminal in Visual Studio Code on Stackoverflow, I think @Trav L answer might be closed one. But need to config a little bit more.
VS Code v1.26.1 as a base version
- Open keyboard shortcut editor from menu File->Preferences->Keyboard Shortcuts (
Ctrl+K Ctrl+S) - Click on the link
keybindings.jsonabove the screen. - Overwrite your custom keyboard shortcuts on the right side panel, the
keybindings.jsonfile will store in your<user dir>\AppData\Roaming\Code\User. With this values you can overloading thekey shortcutwith usingwhenkeyword like code below.
Credit: @wgj user of Stackoverflow
// Toggle between terminal and editor focus{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"},{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}
- Now you can toggle cursor position by press the same key
Ctrl+`, VS Code will recognize base by situation where the cursor is.
Special 1
Use Settings Sync extension for saving your custom key binding and others to your secret GIST (Github), for switching between workstation, it's recommended from me. It's quite convenient for me.
Special 2
Some time I need to kill the terminal pane for get the whole code area screen. So I also setting this to keybindings.json. The result is equal to clicking on the X mark of the terminal pane. (Just change to your favorite key if you would like to)
{"key": "ctrl+k ctrl+`","command": "workbench.action.terminal.kill" },