Vim – open stdin and files in split windows

command linevim

Is it possible to open vim with stdin in one window, and a file in another?

vim - starts vim with text from stdin in the buffer

vim -o file1 file2 starts vim with files in multiple split windows

Can they be combined? vim -o file1 - doesn't work; it dies with a Too many edit arguments error. I know I can use vim - and then :split file1, but I'd like to do it with command-line flags if possible.

Best Answer

Though you cannot use -o, you can execute any commands passed with -c:

$ vim - -c 'split file1'
Related Question