Is it possible to have multiple actions assigned to one keyboard shortcut in visual studio code?
For example: Move cursor up x 3 set to "ctrl + w"
Thanks in advance.
To launch the Define Keybinding widget, press Ctrl+K Ctrl+K. The widget listens for key presses and renders the serialized JSON representation in the text box and below it, the keys that VS Code has detected under your current keyboard layout.
Use Ctrl + D to use multi word edit of same words in Windows and Linux.
You can define a keyboard shortcut for any task. From the Command Palette (Ctrl+Shift+P), select Preferences: Open Keyboard Shortcuts File, bind the desired shortcut to the workbench.
Ctrl + D in Visual Studios (Any Edition) to copy the line down. The equivalent Keyboard Shortcut in VS Code IDE to copy line down : Shift + Alt + ↓
It's possible with extensions like Commands
settings.json
"commands.commands": { "down3": { "sequence": [ "cursorDown", "cursorDown", "cursorDown", ], }, },
keybindings.json
{ "key": "ctrl+w", "command": "down3", },
Or with just keybindings.json
{ "key": "ctrl+w", "command": "commands.run", "args": [ "cursorDown", "cursorDown", "cursorDown" ] },
Feature request to support Macro like keybindings #871.
Although, for this particular example it's better to use the built-in
command (to avoid any jumpiness):
{ "key": "ctrl+w", "command": "cursorMove", "args": { "to": "down", "by": "line", "value": 3 } }
https://code.visualstudio.com/api/references/commands
I use the macros extension (https://marketplace.visualstudio.com/items?itemName=geddski.macros):
in settings.json:
"macros": { "showGit": ["workbench.view.scm", "git-graph.view"] }
then in keybindings.json:
{ "key": "ctrl+shift+g", "command": "showGit" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With