Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

What i want is a command to run from shell which supports:-

myprog1 'someinputfile1' |vim -

and

myprog2 'someinputfile2' |vim -

outputs opened in vim in split screen.

How to redirect stdout output to a new Vim tab? told me to use vsp|myprog <someinputfile> to split an already opened vim window.

share|improve this question

migrated from stackoverflow.com Oct 18 '12 at 10:15

This question came from our site for professional and enthusiast programmers.

    
I don't understand why this was migrated. It is a Vim question, and the accepted answer is a Vim answer. I thought Vim questions on StackOverflow were fine. – Prince Goulash Oct 18 '12 at 12:24
up vote 5 down vote accepted

If you are on linux, try this:

vim -o <(myprog1 'someinputfile1') <(myprog2 'someinputfile2')

Change -o to -O to split vertically.

share|improve this answer
    
The program also takes an input file. Does it work still? – Vineet Deoraj Oct 18 '12 at 7:44
    
You can have <(myprog arg1 arg2), or <(myprog1 arg1 | myprog2 arg2) – kev Oct 18 '12 at 7:45

Well the second one is easy, because it's just a sequence of commands:

ls | vim -
:vertical split
:enew
:read !ls

If you want diffsplit

ls | vim -
:diffthis
:vertical split
:enew
:read !ls
:diffthis

You could create a keyboard mapping for this, something like

:map <F12> :diffthis\|vertical split\|enew\|diffthis<CR>:read !
share|improve this answer

You could use Vim's -c argument to read the first output, open a new tab, and then read the second output. For example:

vim -c ':read !ls dir1' -c ':tabnew | read !ls dir2'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .