Home » Questions » Computers [ Ask a new question ]

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

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

There must be a way, something like this:

Asked by: Guest | Views: 93
Total answers/comments: 2
Guest [Entry]

"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"
Guest [Entry]

"While running vim:

:sp filename for a horizontal split
:vsp filename or :vs filename for a vertical split"