There must be a way, something like this:
vim -[option] <file-list>
to open files from command prompt and not from within Vim.
- split windows vertically or/and horizontally
- in separate tabs
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
-p[N] Open N tab pages (default: one for each file) -o[N] Open N windows (default: one for each file) -O[N] Like -o but split vertically
So type this to open files split horizontally, for example:
vim -o file1.txt file2.txt file3.txt
N is provided the
N windows/tabs will be opened. If
N is less than the number of files in arguments, then the remaining files will be loaded in hidden buffers. If
N is greater than the number of arguments, the remaining windows/tabs will be editing an empty file.
Another useful trick that I just found out, is that you can use wildcards in the filelist to open multiple files. Say you want to open file1.txt, file2.txt, and file3.txt all in separate tabs but don't feel like typing that all out you can just do:
vim -p file*
I frequently find myself needing to open a lot of files with a similar prefix, and this has been quite helpful