Reputation: 56262
When launching vim from the command line, I can do for example vim *.txt
to open all text files in a directory at once.
For some reason, trying the same from inside vim ( :e *.txt
) gives an error: E77: Too many file names
.
Is there a reason why vim refuses to open multiple at once? Is there a way to change that?
Upvotes: 52
Views: 11333
Reputation: 47
:args *.txt
also works.
If it helps there is more information on this topic at :help argument-list
and :help 07.2
. Both of those sections help explain how to use the argument list and how the buffer list is not the same thing.
Upvotes: 1
Reputation: 196546
It's done in two operations.
Open all *.js
files in as many vertical splits:
:argadd *.js
:argdo vs
in horizontal splits:
:argdo sp
in tabs:
:argdo tabe
Upvotes: 15
Reputation: 11532
Also, to add to the other answers, when you first start vim you can open multiple files at the same time, e.g.:
vim *.txt
Upvotes: -2