Last Updated: February 25, 2016
·
1.69K
· nvie

Open files on stdout in Vim

To open all files on stdout in Vim, use the xargs -o option.

ack PATTERN -l | xargs -o vim

The -o option to xargs makes sure to reopen stdin as /dev/tty in Vim, avoiding the annoying "Vim: Warning: Input is not from a terminal" message.

NOTE: Of course, you should make sure that the command above keeps working for files that contain whitespaces, so it's better to do this:

ack PATTERN -l --print0 | xargs -0 -o vim