Yes, you have a couple of options.
(1) Set up a command to just rerun the last command - see Make a keybinding to run previous or last shell commands
{
"key": "alt+x", // choose your keybinding
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b[A\u000d" }
},
or (2) just put your frequently-used command into a keybinding ala:
{
"key": "alt+x", // choose your keybinding
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "dotnet run /path/to/subproject\u000d" },
// "when": "terminalFocus"
},
The \u000d
is a return
so the command runs immediately. I find it easiest to not have the when
clause so I can run it from anywhere - editorFocus or terminalFocus, etc.
These go into your keybindings.json
.
You can use variables where you have /path/to/subproject
. See task - variable substitution and available variables which may help with your path.