Vscode: Integrated terminal: Combine "toggle" and "focus" commands

Created on 29 Jun 2016  路  5Comments  路  Source: microsoft/vscode

Testing #8222

  • VSCode Version: Code - Insiders 1.3.0-insider (d0c2b891903d73e83dcdc7786398ebfa764fc4ee, 2016-06-28T05:04:06.083Z)

Currently I need two keyboard shortcuts to do all three:

  • show and focus terminal when not already shown ("toggle" or "focus")
  • focus terminal when already shown ("focus")
  • hide terminal when shown ("toggle")

This could be simplified by letting the "toggle" command focus the terminal when already shown but not in focus. It would then hide the terminal only when already focused.

Most helpful comment

thanks @Tyriar, ran into same inefficiency, my keybindings.json extension contains

{
        "key": "ctrl+`",
        "command": "workbench.action.terminal.toggleTerminal"
    },
    {
        "key": "ctrl+`",
        "command": "workbench.action.terminal.focus",
        "when": "!terminalFocus"
    }

All 5 comments

I added focus so that ctrl+backtick didn't need to be hit twice to focus an already visible terminal. Related discussion here #7540

thanks @Tyriar, ran into same inefficiency, my keybindings.json extension contains

{
        "key": "ctrl+`",
        "command": "workbench.action.terminal.toggleTerminal"
    },
    {
        "key": "ctrl+`",
        "command": "workbench.action.terminal.focus",
        "when": "!terminalFocus"
    }

I see this issue in the latest version of VSCode (v1.9.1). If the focus is not on the terminal (e.g. focus is on editor) and I have the terminal panel visible, I have to press crtl+backtick twice. Once to toggle the terminal pane off, and the second time to toggle it back on to gain focus.

@leojkwan's suggestion works so that if the terminal panel is not on focus, pressing it the first time will gain focus, and the second time will toggle off the terminal. It would be great if this behavior is enabled by default.

Totally agree, this issue should be reopened.

I opened a similar discussion recently in https://github.com/Microsoft/vscode/issues/19400

Was this page helpful?
0 / 5 - 0 ratings