Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.