Quantcast
Channel: How to switch the cursor between terminal and code in VSCode? - Super User
Viewing all articles
Browse latest Browse all 17

Answer by Natta Wang for How to switch the cursor between terminal and code in VSCode?

$
0
0

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

  1. Open keyboard shortcut editor from menu File->Preferences->Keyboard Shortcuts (Ctrl+K Ctrl+S)
  2. Click on the link keybindings.json above the screen.
  3. Overwrite your custom keyboard shortcuts on the right side panel, the keybindings.json file will store in your <user dir>\AppData\Roaming\Code\User. With this values you can overloading the key shortcut with using when keyword 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"}
  1. 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" },


Viewing all articles
Browse latest Browse all 17

Trending Articles