You can probably write a bunch of Vim script to achieve the desired behaviour, but I'll suggest you take another route.
In Vim, what we know as tabs in other applications, are called buffers. They are a bit confusing at first because by default there's no buffer bar, so there's no way to quickly see all the open buffers. You can install a plugin that makes ...
Vim’s -S option can take any file of vim commands and run them at startup. It’s usually used for sessions (:mksession; pairs well with tpope’s obsession plugin).
In this case, though, you could make the following file
And then you can do vim -S mylayout.vim
I have the answer of my first question:
I have to invoque Vim like this vim -c ":edit file1 | tabedit file2 | vsp file3 | tabedit file4.
But, I’m still answering if it doesn’t a more “elegant” way and less verbose to do the same thing?