Home > Software design >  VSCode how to know when editor is not split?
VSCode how to know when editor is not split?

Time:05-06

Until now, I used cmd 2 to split the editor on Visual Studio Code and then cmd 1 and cmd 2 to move between the split editors. This shortcut stopped working for some reason, and I can't set it on the keyboard shortcut menu either. I checked with another keyboard, so this is not an hardware issue. Anyhow, I tried to set new keybindings to split the screen and move between the editors, like this:

[
    {
        "key": "cmd shift ]",
        "command": "workbench.action.navigateRight",
        "when": ""
    },
    {
        "key": "cmd shift ]",
        "command": "workbench.action.splitEditorRight",
        "when": ""
    },
    {
        "key": "cmd shift [",
        "command": "workbench.action.navigateLeft",
    },
]

The only problem, I couldn't find what I need to write in the when option. I want my shortcut to split the editor only if the editor is not split yet, and to move between the editors when it is. How can I achieve that?

CodePudding user response:

The multipleEditorGroups when clause context returns true when there's more than one editor group open.

CodePudding user response:

You don't need to put a "when" for neither of them. Just checked vscode defaults and they don't have any.

  • Related