Search code examples
visual-studio-codekey-bindings

Understanding VSCode keybindings: <cmd+X cmd+Y> vs. <cmd+X Y>


Here is an example of two key bindings in VSCode (with factory settings):

{ "key": "cmd+k cmd+left",        "command": "workbench.action.focusLeftGroup" }
{ "key": "cmd+k left",            "command": "workbench.action.moveActiveEditorGroupLeft" }

I don't understand what you need to do differently to the keyboard to distinguish between these two commands involving the same buttons. Pls enlighten me.

(Bonus points if you can provide an exhaustive understanding of keybindings syntax; e.g. meaning of 'space' vs '+', etc.)


Solution

  • Typically when there is a "+" in a keybinding, it means "push both of these together (or hold the modifier key and hit the other key". A space is a separator between steps (you could also think of it as "let go of any keys you were holding down").

    So "cmd+k cmd+left" means "hold command and hit 'k' then hold command and hit left".

    But "cmd+k left" means "hold command and hit 'k' then hit left (without holding any other keys)".