reading up on some vim tips, I came across :r!{command}
and :.!{command}
, both of which take the output of the shell <command>
and put it in the current buffer.
I imagine the 'r
' to stand for 'read', but how am I to 'translate' the dot in the command above?
And: do they have the exact same function?
Thanks a lot for your insights!
Guba
The dot is a region, referring to the current line. The !
then takes this region and pipes it through the command.
So, for example, if you do:
:.!rev
You'll reverse the order of characters in the current line.
Of course, if you use a command that ignores its input, you'll just replace the current line with whatever the output is.
:r!
, on the other hand, inserts the output after the current line, without removing the current line's text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With