VS Code allows multiple tasks to be defined in the ["tasks"]
array in tasks.json
and the one with the property isBuildCommand: true
gets given the keyboard shortcut Ctrl+Shift+B by default.
I would like to assign different keyboard shortcuts to each of the tasks I've created. Is this possible, and if so how?
All I've found so far is the ability to assign a shortcut to the command workbench.action.tasks.runTask
which will popup a menu of all the tasks in alphabetical order that I can up/down arrow through. I would like to configure Code to run each task directly with one key combination.
All keyboard shortcuts in VS Code can be customized via the keybindings. json file. To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.
For multi-line selection, Ctrl+Alt+Down / ⌘+Alt+Shift+Down will extend your selection or cursor position to the next line.
As of VS Code 1.10, you can use the workbench.action.tasks.runTask
command in your keybindings, and pass in the task's name as your argument.
The VS Code task documentation gives this example:
{ "key": "ctrl+h", "command": "workbench.action.tasks.runTask", "args": "build" }
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