Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I redirect output of a program to gvim?

Tags:

vim

I want to redirect the output of some Windows program directly to gvim basically for searching the output. Say for example the result of findstr cmd. Is it possible to do this without dumping it to a file and subsequently loading that file in gvim?

like image 675
Canopus Avatar asked May 13 '09 06:05

Canopus


3 Answers

sure:

dir | gvim -

the - option tells vim to open stdin

This works for Windows and Linux versions.

like image 137
Nathan Fellman Avatar answered Nov 09 '22 21:11

Nathan Fellman


If you're already in Vim you can use the r command to read like this:

:r !<cmd>

E.g.

:r !dir
like image 23
Brian Rasmussen Avatar answered Nov 09 '22 19:11

Brian Rasmussen


You can read it from vim with

:r !dir (for example)
like image 3
Rook Avatar answered Nov 09 '22 19:11

Rook