Search code examples
visual-studio-codealacritty

How can I create a keyboard shortcut for VS Code to open a new external terminal?


I want to change the terminal for a better presentation of my project, so I don't want to use the integrated VS Code terminal, I would like to use my system's own terminal which is Alacritty (I'm using linux)

I've been changing the settings in VSCode's settings.json file, but no matter how hard I try I couldn't get the Ctrl + j command to open the alacritty terminal as a floating terminal.

What I want to achieve is almost the same as with AstroNvim, when using the open terminal floating command, it opens Alacritty as a float.


Solution

  • The keyboard command ID you're looking for is workbench.action.terminal.openNativeConsole. Ex. in keybindings.json (open using Preferences: Open Keyboard Shortcuts (JSON) in the command palette):

    {
        "key": "", // TODO: pick something.
        "command": "workbench.action.terminal.openNativeConsole",
        "when": "!terminalFocus",
    },
    

    If you want to use ctrl+j, then put "ctrl+j" in the key property's value. But I wouldn't suggest doing that because ctrl+j is the default binding for toggling the panel's visibility- not opening a new integrated terminal. So unless you plan to replace the keybinding for toggling the panel's visibility, or don't care to toggle the panel visibility with a keyboard shortcut, I'd suggest to use something else.