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:

{ "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:

{ "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 and keyboard shortcuts.

Recipes