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:

1{
2  "label": "Test Affected",
3  "type": "shell",
4  "command": "nx affected --target=test"
5}
6

Then from the Command Palette (⇧⌘P) choose Preferences: Open Keyboard Shortcuts (JSON). Then add the following shortcut:

1{
2  "key": "ctrl+cmd+t",
3  "command": "workbench.action.tasks.runTask",
4  "args": "Test Affected"
5}
6

Now, pressing ^⌘T will run nx affected --target=test.

Here is more information on VSCode tasks and keyboard shortcuts.