magic wands! They’re awesome. Learnt about them from
magic wands is his term)
In command mode, you can hit
!! twice, to bring up a prompt which will send the current line to some external command.
For example, if you write:
and then on that line, type
!!bash, it’ll send that to bash, and replace the current line with the output of that command.
Could just as easily send some snippet of code to python or perl, or anything.
:.$ to run vim commands
:.! to run external commands
This doesn’t have to be on single lines though, you can do
6!! to send 6 lines to some external command.
As an example for vim commands, the keystrokes you’d have to do to write 5 lines to another file would be:
delete is to replace the
! (external vim command) to a
$, which specifies a vim command.
The line would look like:
.,.+4 is generated by vim when you do
$:w /tmp/foo is the command I typed in.
I have a script called
ix here which accepts some text as STDIN and makes an
ix (pastebin), so I can do something like:
5!!ix -v (which becomes
.. which takes those 5 lines and uploads them to
ix, copying a link to that paste to my clipboard, without ever leaving