More Vi tips get the pipe output of a command


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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© All Right Reserved