You can put those configuration in a customized script file, then optionally use that script file to open your workspace configuration.
Script file:
:bl
:bf
:tabe
:n
:split
:vsplit
:wincmd l
:n
:wincmd j
:n
:n
:vsplit
:wincmd l
:n
:wincmd h
:wincmd k
:tabn
And you can call it as such:
vim -S script.vim file1.txt file2.txt file3.txt file4.txt file5.txt
This will open vim on file1.txt, with an open tab next to it, according to your configuration, and put the cursor on the upper left file (file2.txt) when you switch to it.
Added explanation of each line:
Note that when we split, the cursor will stay on the original window, and that each window will show different files, which can be navigated independently using :n
and :N
. When a new window is created, it will display the same file as the window we're in when we created the window.
As noted in my comment, the first two lines is to tell VIM that we have read every file, so VIM won't complain "4 more files to edit" at the end of the session.
:bl Go to last file
:bf Go to first file
:tabe Create new tab
:n Open next file (file2.txt)
:split Split horizontally (will create new window below with the content of file2.txt)
:vsplit Split vertically (will create new window on the top right with the content of file2.txt)
:wincmd l Go to the window to the right (which currently displays file2.txt)
:n Open next file (file3.txt)
:wincmd j Go to window at the bottom
:n Open next file (file3.txt, because bottom window was displaying file2.txt)
:n Open next file (file4.txt)
:vsplit Split vertically (will create new window on the right with content file4.txt)
:wincmd l Go to window to the right (which is bottom right)
:n Open next file (file5.txt, because bottom-right window was displaying file4.txt)
:wincmd h Go to window to the left
:wincmd k Go to window above (this sets the cursor on file2.txt on top left)
:tabn Go to next tab (the first one, displaying file1.txt)