Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to redirect the output of a process (in bash) into an existing instance of (g)vim?

Something like:

cat myfile1.txt | awk 'print $1' | gvim -

Then I might start a new window inside my vim with :vne and want to fill it with the output from some other process.

share|improve this question
up vote 2 down vote accepted

Your example works but it can't be used as is from your terminal to open a second output in a second window.

You can put the output of your command in the active buffer from within Vim itself with

:read !cat myfile1.txt | awk 'print $1'

That's the simplest solution I can think of.

You can also use GVim as a server and send it your output, see :h clientserver.

share|improve this answer
I can't figure out why process substitution won't work with the --remote option. gvim --remote somefile.txt does what you'd think, but gvim --remote <( cat somefile.txt ) opens an empty file. – Andrew Wood Feb 2 '12 at 16:20
gvim --servername NAME --remote-send ':read !cat file.txt<CR>' works. – romainl Feb 2 '12 at 17:23
gvim --servername NAME --remote-send ':vnew | :read !cat file.txt<CR>' works too. – romainl Feb 2 '12 at 17:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.