I would like to open, say, 4 files and then have windows arranged in a grid so that the first file was in top left, second bottom left, third top right and fourth bottom right.
So a command like this (with an imaginary argument -Q)
vim -Q <some stuff> file1.txt file2.txt file3.txt file4.txt
would result in
------------------------------
| file 1 | file 3 |
| | |
|-----------------------------
| file 2 | file 4 |
| | |
|-----------------------------
You can use the -o or the -O arguments to produce a window for each file but the resulting windows are split, respectively, horizontally or vertically but not in a grid as shown above.
I've noticed that there is a -c argument which allows a command to be executed after loading the first file but I'm not sure what sort of command I could issue to define window layout and in any case any command would probably need to be executed after the last file had been loaded.
Would be interested in any suggestions.
BTW although my example uses four files I would like a more general solution as I'm more usually dealing with 8 or 10 files.
Thanks
:mksession ~/.my-important-sessionand then start vim withvim ~/.my-important-session? You could even create a bash alias for this command. EDIT Oh or maybe I misunderstood and what you actually want is to keep the layout but being able to use it with different files each time? – statox Sep 02 '20 at 09:08:h winlayout()and:h winrestcmd()if you really want to mess with it. – Matt Sep 02 '20 at 09:49-cor a custom session file to create a specific layout on startup. – filbranden Sep 02 '20 at 11:31