Switching between VSCode terminals using hot keys

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 th…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Switching between VSCode terminals using hot keys." Daniel Feldroy | Sciencx - Saturday April 10, 2021, https://www.scien.cx/2021/04/10/switching-between-vscode-terminals-using-hot-keys/
HARVARD
Daniel Feldroy | Sciencx Saturday April 10, 2021 » Switching between VSCode terminals using hot keys., viewed ,<https://www.scien.cx/2021/04/10/switching-between-vscode-terminals-using-hot-keys/>
VANCOUVER
Daniel Feldroy | Sciencx - » Switching between VSCode terminals using hot keys. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/10/switching-between-vscode-terminals-using-hot-keys/
CHICAGO
" » Switching between VSCode terminals using hot keys." Daniel Feldroy | Sciencx - Accessed . https://www.scien.cx/2021/04/10/switching-between-vscode-terminals-using-hot-keys/
IEEE
" » Switching between VSCode terminals using hot keys." Daniel Feldroy | Sciencx [Online]. Available: https://www.scien.cx/2021/04/10/switching-between-vscode-terminals-using-hot-keys/. [Accessed: ]
rf:citation
» Switching between VSCode terminals using hot keys | Daniel Feldroy | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.