I find myself doing a lot of hotfixes on my code, and I have to test on a remote machine. In visual studio code, is there a way to set up a macro that will
Thanks!
To do this, you need to run multiple commands at once, so you will need an extension. With ryuta46.multi-command, and this configuration, Ctrl+Alt+S
will save and push all of your files
settings.json (Ctrl+,
):
{
"multiCommand.commands": [{
"command":"multiCommand.syncAllFiles",
"sequence": [
"workbench.action.files.saveAll",
{
"command": "workbench.action.tasks.runTask",
"args": "syncAll"
},
"workbench.action.terminal.toggleTerminal"
]
}]
}
I've added a command to toggle the terminal after the command is run so that it doesnt stay open every time you run the command. Unfortunately, it happens even if the terminal was already open, so if you don't want it to do that, just remove that line
keybindings.json (Ctrl+K
Ctrl+S
):
{
"key": "ctrl+alt+s",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.syncAllFiles" },
},
tasks.json:
{
"tasks": [
{
"label": "syncAll",
"type": "shell",
"command": "git add .;git commit -m 'Automatic Commit';git pull;git push",
}
]
}