VS Code v1.69 was launched final week. As with every of the earlier releases, it got here full of new options. I discovered a few of them to be fairly helpful and have already used them to tweak my VS Code setup.
On this quick put up I’m going to indicate you one new function that I like particularly – the “Terminal: Run Current Command” command.
Earlier than we glance into what this command does, how typically do you utilize the up arrow key within the Terminal to discover a beforehand executed command? Very often, proper? You do not forget that you ran one explicit command yesterday however you may’t actually bear in mind which was it. So you utilize the up arrow key to go trough the current instructions, one by one, to search out the one you want. I do this on a regular basis too.
What if there was a approach to see a listing of current instructions and shortly discover the one you want. That will be so significantly better, wouldn’t it?
Right here’s the place the “Terminal: Run Current Command” command is available in. Once you run it, you get a listing of current instructions in a Fast Choose-like panel just like the Command Palette or Fast Open panel. It appears like this 👇
Go forward and take a look at it. Open a Terminal, then open the Command Palette (Ctrl/Cmd+Shift+P
) and run the “Terminal: Run Current Command” command. Deciding on a command from the record will routinely run it.
However wait, there’s extra
If you happen to maintain the Alt
key whereas deciding on a command, the textual content will likely be written within the Terminal with out operating it. This manner you may modify it if you could. You may also seek for a command within the enter discipline.
Assigning a key keybinding
The “Terminal: Run Current Command” command doesn’t have a keybinding assigned by default. Within the launch put up, an instance is given the place Ctrl+House
is used for hooking up the command to a keybinding. I used that suggestion in my setup. Works fairly nicely.
If you happen to too wish to use it, run the Preferences: Open Keyboard Shortcuts
command, then click on on the “Open Keyboard Shortcuts (JSON)” icon (appears like a “file-with-an-arrow-pointing-right”) all the way in which to the fitting to open a file along with your private keybinding combos. Then paste the next snippet 👇
{
"key": "ctrl+area",
"command": "workbench.motion.terminal.runRecentCommand",
"when": "terminalFocus"
}
Now you can use Ctrl+House
to open the record of current instructions when the Terminal is in focus.
I additionally recorded a brief video explaining the put up above.
I hope you discovered a little bit tip at the moment. Glad coding 😎