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!

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect

Recent posts

  1. Loading Mastodon feed…