Canopus
Canopus

Reputation: 7447

Can I redirect output of a program to gvim?

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?

Upvotes: 45

Views: 9128

Answers (4)

user674669
user674669

Reputation: 12352

AFAIK, there is no gvim on Mac OS.

If you are using MacVim on mac, this is what I do:

dir | /Applications/MacVim.app/Contents/MacOS/Vim -

When Vim starts in the terminal, then type

<esc>:gui

That should start the MacVim (gui version of vim)

Upvotes: 1

Brian Rasmussen
Brian Rasmussen

Reputation: 116401

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

:r !<cmd>

E.g.

:r !dir

Upvotes: 23

Nathan Fellman
Nathan Fellman

Reputation: 127428

sure:

dir | gvim -

the - option tells vim to open stdin

This works for Windows and Linux versions.

Upvotes: 87

Rook
Rook

Reputation: 62538

You can read it from vim with

:r !dir (for example)

Upvotes: 3

Related Questions