Macro like keybindings
When creating keyboard shortcuts, it would be nice if you could pass an array of commands (to execute like a macro) that would run the commands in that order.
So take this for example:
{
"key": "ctrl+s",
"command": [
"editor.action.format",
"editor.action.trimTrailingWhitespace",
"workbench.action.files.save"
],
"when": "editorTextFocus"
}
It would format the file, remove trailing white space then save the file.
Abolutely what I was thinking! - another example (mine)
{
"key": "winl+b",
"command": [
"workbench.action.tasks.terminate",
"workbench.action.tasks.build"
]
}
love this idea
Show any plain text in addition to commands will be great:
For example, using ctrl+; to move to the end of line and add ; and then move to the next line.
{
"key": "ctrl+;",
"commands": [
"cursorEnd",
";",
"editor.action.insertLineAfter"
],
"when": "editorTextFocus"
}
I'm surprised to see so few votes on this issue. I was looking for a way to bring up a terminal and hide the file explorer at the same time, since the integrated terminal doesn't occupy 100% width, and it seems vscode does'nt support multiple commands on a single keybindings yet. :(
Also, #6617 for ref.
+1
+1
+1
Hi guys, I've just found out the extension macros which is exactly I was looking for. Hope this helps you overcome this limitation.
You probably want to allow arguments, for example when using the type command:
{
"key": "ctrl+;",
"commands": [
{
"command": "cursorEnd"
},
{
"command": "type",
"args": { "text": ";" }
}
]
"when": "editorTextFocus"
}
If anyone on the core team would flag this with "help wanted" or "good first issue" i'd love to help out !
Ok so this isn't really answer to issue in vscode, but one work around i found was to use autohotkey.
FYI, I know this is slightly off-topic but for anyone using their machine to code and as a gaming platform: autohotkey can trigger video games anti-cheat programs. If you don't want to get kicked/banned during your next session of battlefield, be sure to have autohotkey turned off before playing. :)
Bump. This would be very very helpful.
I'd also love to have this feature :)
Is this workable now? I want to customize vscode suggestion selection just like Visual Studio "select" and "print . or ("
When could we have this feature :(
Use case: comment/uncomment line and move cursor down like in IntelliJ IDEA.
{
"key": "cmd+/",
"command": ["editor.action.commentLine", "cursorDown"],
"when": "editorTextFocus && !editorReadonly"
}
Another use case is to locate the file in file explorer and make the file explorer active like resharper.
{
"key": "shift+alt+l",
"command": ["workbench.files.action.showActiveFileInExplorer", "workbench.view.explorer"]
}
You can currently do this using the multi-command vscode extension! 😃
+1, surprised that this generic feature does not exist in the base vscode