How to open files in vertically/horizontal split windows in Vim from the command line

command linevimwindow

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

Best Answer

I'm assuming you mean from the command line. From vim --help:

-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