-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macro like keybindings #871
Comments
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
|
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. |
This comment was marked as duplicate.
This comment was marked as duplicate.
2 similar comments
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
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
|
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. :) |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Theres no way of running commands like: editor.action.insertSnippet |
Created another extension that can run multiple commands: https://marketplace.visualstudio.com/items?itemName=usernamehw.commands {
"key": "ctrl+s",
"command": "commands.run",
"args": [
"editor.action.format",
"editor.action.trimTrailingWhitespace",
"workbench.action.files.save"
],
"when": "editorTextFocus"
} |
Looks great 😀 |
You mean, like https://marketplace.visualstudio.com/items?itemName=ryuta46.multi-command? ;) |
Yes, but like, |
This comment was marked as duplicate.
This comment was marked as duplicate.
I think that @ liangjiancang's suggestion above about the ability to define |
Hello everyone! 👋 VS Code team engineer here 🙂 Just wanted to let you know that we added a built-in command We encourage people to try it out and report issues/suggest improvements in new issues (there is now a GitHub issue label You can read more about the command here: https://code.visualstudio.com/docs/getstarted/keybindings#_running-multiple-commands Make sure you're on latest VS Code version - 1.77. |
@ulugbekna That's a great news, thanks so much! |
Tested and it works 😉 |
Thanks, this works great! Would it be possible to add an argument to the runCommands action to optionally compress the commands into a single Undo action? If that is a big ask I can create a new issue for it. For example, I am using a "Join Lines without inserting whitespace" key binding like so: {
"key": "ctrl+shift+j",
"command": "runCommands",
"args": {
"commands": [
"editor.action.joinLines",
"deleteRight"
]
},
"when": "textInputFocus"
} This works great but to undo it you need to Undo twice. Being able to only Undo once would be ideal. |
I just tried it with this:
And it failed. It did not do arrow left after breadcrumbs were focused. |
Instead of |
Having an issue with What I'm trying to accomplish is opening the Example Keybind: [
{
"key": "ctrl+shift+/",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.openApplicationSettingsJson",
"workbench.action.openSettingsJson"
]
}
}
] When executing the keybind, I get a VS Code alert:
As well as the following Output -> Window log:
With VS Code Web, I do get a different alert: With the following log in console:
This is without any extensions running (fresh profile). Produced identical results with no extensions and a default profile:
Also, it would be great (and enough to get me by) if there was a way to execute commands and continue regardless of failure? In my example, I may not have a workspace open, so if I opened Application -> Workspace -> User, and no workspace, user would also not open. |
I'm confused, was it easier to implement completely new command, rather than check for type of value in existing command, and if it's a string execute it, if it's an array execute each item in the array? |
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:
It would format the file, remove trailing white space then save the file.
The text was updated successfully, but these errors were encountered: