This content originally appeared on DEV Community and was authored by Daniel Feldroy
When I code I prefer to keep my hands on the keyboard as much as possible. For me, this keeps me more focused on the task at hand. Switching to the mouse is something try to I reserve for interacting with browsers.
By default VSCode doesn't include the keybinding necessary to switch terminals via the keyboard. You are forced to use the mouse, which disrupts my flow.
Here's how you add terminal switching keybindings in VSCode:
Step 1
Use ctrl+p
(cmd+p
on the Mac) and type keybindings.json
. Select the file from the drop downlist. This will open a file that looks like this:
// Place your key bindings in this file to
// override the defaults
[]
Step 2
Replace the contents of keybindings.json
with this for Windows or Linux:
// Place your key bindings in this file to
// override the defaults
[
{
"key": "ctrl+down",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "ctrl+up",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
}
]
Or this when using the Mac:
// Place your key bindings in this file to
// override the defaults
[
{
"key": "cmd+down",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "cmd+up",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
}
]
Now you can use the keyboard to change terminals in VS Code.
This content originally appeared on DEV Community and was authored by Daniel Feldroy
Daniel Feldroy | Sciencx (2021-04-10T03:10:14+00:00) Switching between VSCode terminals using hot keys. Retrieved from https://www.scien.cx/2021/04/10/switching-between-vscode-terminals-using-hot-keys/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.