I know how to split windows in vim, but it's possible to open multiple files using vim in split mode (at startup) from the command line?
In example:
vim file1 file2 file3
or:
vim *.cpp
I know how to split windows in vim, but it's possible to open multiple files using vim in split mode (at startup) from the command line?
In example:
vim file1 file2 file3
or:
vim *.cpp
You can use the option -o
to open the files in horizontal splits or -O
(letter "O") to open vertical splits. The following commands open a window for each file specified:
vim -o *.cpp
vim -O foo bar baz
You can tell Vim the maximum number of windows to open by putting an integer after o
or O
options, the following example will open at most two windows no matter how many file matches, you will see the first two file specified on the command line, the rest will remain hidden:
vim -o2 *.cpp
See :help -o
for all the details.