April 5, 2023

Pipe Into Vim

You can pipe stuff stuff into vim.

I didn’t know about this, but take a look at the second usage example in the output of vim -h:

~ $ vim -h
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jan 29 2023 18:57:15)

Usage: vim [arguments] [file ..]       edit specified file(s)
   or: vim [arguments] -               read text from stdin
   or: vim [arguments] -t tag          edit file where tag is defined
   or: vim [arguments] -q [errorfile]  edit file with first error

Just pass - to open up a new buffer with the output of something.

Try to run ls | vim - and you’ll get the list of the current directory into a new buffer to play with in vim.

Have fun.

© Mauro Scomparin 2020 - 2023

Powered by Hugo & Kiss.