More Vi tips get the pipe output of a command

0

OK, this is kind of a neat trick. If you want to get the output of a shell command into Vi for further editing, there is an extension to the read command where you can say take the output of a pipe.

:r !ls

What this says is to do a read like a traditional file, but the exclamation point means interpret the rest like a shell command and then take the stdout and stick it into the file at the point. Pretty cool!

Related Posts

© All Right Reserved