How can I add multiple keyboard shortcuts to a single command in VS Code?
As an example (from the comments), ctrl
+ 0
& ctrl
+ 1
should both do the same command/action. So completely separate shortcuts doing the same command.
Let's say there are 2 bindings to close window like so:
Let's say we want to add one more keybinding like CMD+K, CMD+1. You could do that by right-clicking a command and choosing copy like so:
Then, click on an icon on the top right corner to open keyboard shortcuts JSON. The icon has an curved arrow on a page:
Your user-defined keybindings.JSON will show up. Type this in it:
// Place your key bindings in this file to override the defaults
[
{
"key": "cmd+k cmd+1",
"command": "workbench.action.closeWindow"
}
]
Save and close.
Now you will see 3 keybindings for the action like so:
Now, try your new keybinding.
ctrl
+k
,ctrl
+c
to comment a block (as in multiple keys in series to do a thing), or are you thinkingctrl
+0
andctrl
+1
should do the same thing?ctrl
+0
&ctrl
+1
should do the same action/command.