Terminal Command KeysAssign terminal commands to a keybinding. Open your keybindings.json (Command Palette => 'Preferences: Open Keyboard Shortcut File') and add an entries like these:
The "cmd" : requiredThis is the command that will be passed to the terminal when it is opened. The following substitutions are available to be used:
Here are some examples:
If you need to run different commands for different file types, but wish to use the same keycombo, check out vscode's "when" clauses. "newTerminal" : optional, default falseIf true, the terminal is destroyed and a fresh terminal is created for each run. You cannot scroll up to review previous commands/results. If false, re-uses the same terminal for each command run. You can scroll up to review previous commands/results. "saveAllFiles" : optional, default trueIf true, saves all files before running the command. If false, does not save all files before running the command. "showTerminal" : options, default trueIf true, ensures that the terminal is showing when running the command. If false, does not change the visibility of the terminal when running the command. "focus" : options, default false, locked to false if "showTerminal" is falseIf true, ensures that the terminal is focused when running the command. If false, focus is not applied to the terminal when running the command. "terminalName" : options, default "terminal-command-keys"Allows you to set a custom name for the terminal associated with this command, allowing you to associate different commands with different terminals. Thanks to @qzsiniong. AboutThis extension inspired by run-in-terminal and send-to-terminal. The differences (at this time):
|