nx/docs/shared/recipes/console-shortcuts.md
Isaac Mann e717660102
docs(nx-dev): diataxis restructure (#11649)
* docs(nxdev): restructure docs to diataxis style

* docs(nxdev): cleanup

* docs(nxdev): fix links

* chore(nxdev): format

* docs(nxdev): fix broken images

* docs(nxdev): fix links

* docs(nxdev): fix links

* docs(nxdev): fix links

* docs(nxdev): tweaks

* docs(nxdev): redirect rules

* docs(nxdev): fixes
2022-08-29 08:36:55 -04:00

34 lines
1.0 KiB
Markdown

# Nx Console Keyboard Shortcuts
If you find yourself running the same command many times, here are few tips to save yourself some key strokes.
**Rerun Last Task**
If you want to rerun the last task with all the same options specified, bring up the Command Palette (`⇧⌘P`) and choose `Rerun Last Task`.
**Keyboard Shortcuts**
You can also set up custom tasks and assign keyboard shortcuts to them. In `.vscode/tasks.json` add a task like this:
```json
{
"label": "Test Affected",
"type": "shell",
"command": "nx affected --target=test"
}
```
Then from the Command Palette (`⇧⌘P`) choose `Preferences: Open Keyboard Shortcuts (JSON)`. Then add the following shortcut:
```json
{
"key": "ctrl+cmd+t",
"command": "workbench.action.tasks.runTask",
"args": "Test Affected"
}
```
Now, pressing `^⌘T` will run `nx affected --target=test`.
Here is more information on [VSCode tasks](https://code.visualstudio.com/docs/editor/tasks) and [keyboard shortcuts](https://code.visualstudio.com/docs/getstarted/keybindings).