Scorb
Scorb

Reputation: 1850

Close build panel in Visual Studio Code

Whenever I run a build in Visual Studio code, a panel pops up with my build output.

Is there a way I can close this panel with a keyboard shortcut?

In Sublime Text, I just hit esc and it closes. Can this behaviour be mimicked in VSCode?

Upvotes: 4

Views: 2291

Answers (4)

rsjethani
rsjethani

Reputation: 2227

I have been using VS Code since version 1.60 and ctrl + j seems to be the default shortcut for minimizing the build/terminal/problems panel.

Upvotes: 0

Preston L. Bannister
Preston L. Bannister

Reputation: 383

To be clear, I also miss this behavior from Sublime Text, and Visual Studio (not Code) - as remembered. If you look at the present default key bindings in Visual Studio Code, you can see that some effort has been made in this direction - if somewhat confused. Filed an issue: https://github.com/microsoft/vscode/issues/124771

Got feedback from the VSCode folk, and they offered a key-binding, which I currently use.

    {
        "key": "escape",
        "command": "workbench.action.closePanel",
        "when": "editorTextFocus && panelVisible"
    },

Upvotes: 3

henry zhu
henry zhu

Reputation: 651

Binding new Escape shortcuts is dangerous, because it will break many default VSCode behaviours.

I would rather use Ctrl+` instead of Escape to do this work, witch is the default shortcut to toggle terminal panel both in Sublime Text and VSCode.

By default, if you were not focused in terminal panel currently (say you were in OUTPUT panel, DEBUG CONSOLE panel...), you would need to press Ctrl+` for 2 times: the first time to switch to terminal panel, the second time to toggle off terminal panel.

This behaviour doesn't feels good. What we actually want is to press Ctrl+` only once to toggle the whole panel. To do this, here is my configuration in keybindings.json:

[
    // disable default shortcut for toggling panel
    {
        "key": "ctrl+j",
        "command": "-workbench.action.togglePanel"
    },

    // disable default shortcut for toggling terminal panel to release "Ctrl+`"
    {
        "key": "ctrl+oem_3",
        "command": "-workbench.action.terminal.toggleTerminal"
    },

    // set "Ctrl+`" as new shortcut for toggling panel
    {
        "key": "ctrl+oem_3",
        "command": "workbench.action.togglePanel"
    }
]

Upvotes: 1

VonC
VonC

Reputation: 1323963

You can define a shortcut for hiding the current terminal

For instance, mine is:

{
  "key": "ctrl+l",
  "command": "workbench.action.terminal.toggleTerminal"
}

Or you can set one for

{
  "key": "escape",
  "command": "workbench.action.closePanel"
}

The last one will imitate your SublimeText experience.

Upvotes: 5

Related Questions