VS Code Key Binding for quick switch between terminal screens?

后端 未结 4 2088
鱼传尺愫
鱼传尺愫 2021-01-31 02:46

I\'m trying to figure out if there is a way to set up a key binding to allow a quick switch between the terminal windows I have open in the built in terminal rather than having

4条回答
  •  感动是毒
    2021-01-31 03:30

    Here's the solution I built that works well for me on OSX.

    It mimics the same shortcuts used in the editor to open new files (cmd+n) and switch between tabs (cmd+left|right) and the same shortcuts work for terminals when that view is in focus.

    Hit cmd+shift+p and type keyboard to find Preferences: Open Keyboard Shortcuts File

    Add the following to the keybindings.json file and save it.

    {
        "key": "cmd+alt+right",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+alt+left",
        "command": "workbench.action.terminal.focusPrevious",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+n",
        "command": "workbench.action.terminal.new",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+w",
        "command": "workbench.action.terminal.kill",
        "when": "terminalFocus"
    }
    

    It also does the same for closing terminals (cmd+w)

提交回复
热议问题