'VSCode how to know when editor is not split?
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?
Solution 1:[1]
The multipleEditorGroups
when clause context returns true when there's more than one editor group open.
Solution 2:[2]
You don't need to put a "when" for neither of them. Just checked vscode defaults and they don't have any.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | isaactfa |
Solution 2 | Client |