DEV Community

Daniel Feldroy
Daniel Feldroy

Posted on • Originally published at pydanny.com

5 2

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 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
[]
Enter fullscreen mode Exit fullscreen mode

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"
    }
]
Enter fullscreen mode Exit fullscreen mode

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"
    }
]
Enter fullscreen mode Exit fullscreen mode

Now you can use the keyboard to change terminals in VS Code.

AWS Q Developer image

Your AI Code Assistant

Implement features, document your code, or refactor your projects.
Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay