I have four files file1
, file2
, file3
, & file4
. So I want to open them with vim directly from command line and get the following structure:
- Tabulation 1:
file1
taking whole tab - Tabulation 2:
file2
andfile3
sharing the same tab in split mode - Tabulation 3:
file3
taking whole tab
So, how to do it directly from the invocation? I know I can do from vim, when I open it the following command sequences:
:e file1
:tabedit file2 | vsp file3
:tabedit file4
But then, I have two question:
First question — How can I give this script to vim at the invocation and will it produce the expected behavior?
Second question — Is their another building and probably more elegant way to do this file structure without script? I imagine a syntax like this: vim -p file1 [ file2 | file3 ] file4
, where the []
means al what we do inside it should be appear in one tab, and the symbol |
means the two file should be vertically spited. Is such syntax exist or am I just dreaming about it?
:h session-file
could be what you need here. It does not directly let you organize the layout from invocation, but makes it easy to save an existing state which you can then reuse.:mksession session.vim
vim -S session.vim
.