Pipe text into Vim from stdin

February 18, 2018|
1 min read
  • vim

Originally posted by me on Hashrocket TIL

You can pipe text into vim directly from stdin. This can be helpful if you want to edit the output of a long bash command, or if you want to see what an installation script contains before piping it into bash.

curl -fsSL https://raw.github.com/cknadler/vim-anywhere/master/install | vim -

The key is to use the - after the vim command to make it read from stdin. This will open a new buffer with the output of the previous command.

© 2023, Dorian Karter