I know that with this command:
:yyp!!bash
I can execute current line and print the output in the next line (actually it copies the current line to the next line, executes it, and replaces it with the output), to get from this:
echo "Hello"
to this (after the command above):
echo "Hello"
Hello
I also know that I can use this command:
:w !bash
To execute the selected lines (plural) and show the output in the window below the editor.
What I want is to be able to select multiple lines, execute it in bash, and print the output in vim. How can I do that?
So desired behavior is to get from:
echo \
-e "Hello\nWorld"
echo "Hi"
to:
echo \
-e "Hello\nWorld"
echo "Hi"
Hello
World
Hi
yp
is notyyp
y
is enough to copy). If I change it toyy
and did not select a line, it works. My question still stand then, how to select a few lines, and then use a shortcut to perform the command.