VS Code Send snippet to Terminal
Send code snippet to Terminal by automatically expanding the code block to cover the multiline command.
Features
This extension expands code block automatically before sending it to Terminal.
It works both with Bash and with PowerShell.
Example multiline command in Bash:
curl \
-X GET \
https://bing.com
Example multiline command in PowerShell:
curl `
-X GET `
https://bing.com
Now if you execute send-snippet-to-terminal.send-multiline
in VS Code
when your cursor is anywhere in those lines in your editor, then
extension will automatically select the entire block and then sends it to Terminal
for execution. This makes your script development much faster.
To enable this command with handy keyboard shortcut like e.g., Shift-Enter
,
then follow these instructions:
- Open
Show all commands
(Windows: Ctrl-shift-p
or F1
).
- Open
Preferences: Open keyboard shortcuts
.
- Find
Send snippet to Terminal
and set that be your preferred shortcut e.g., shift-enter
.
Note: You need to then search with that shortcut to remove other shortcuts
that might overlap with your selection.
Extension Settings
send-snippet-to-terminal.send-multiline
: Send multiline command to Terminal.
send-snippet-to-terminal.send-clear
: Send clear
command to Terminal.
Release Notes
0.0.3
Add support for sending clear
command to Terminal.
0.0.2
Add support for opening Terminal, if not already open.
0.0.1
Initial release