vim: open 4 files split horizontally AND vertically

viewport, vim

Solution

Not that elegant with `-o` or `-O`:

vim file4 -c 'split file2' -c 'vsplit file1' -c 'wincmd j' -c 'vsplit file3'

Problem

On the command line, vim can open 4 files split horizontally, ``` vim -o file1 file2 file3 file4 ``` or 4 files split vertically, ``` vim -O file1 file2 file3 file4 ``` How do I open 4 files such that they are split both horizontally and vertically, like this?: ``` ----------- | | | | 1 | 2 | | | | ----------- | | | | 3 | 4 | | | | ----------- ```

Original source