Is it possible to get vim to open multiple files into tabs, similar to the way the args <path> command will open multiple files into buffers?

Doing something like :tabe ./* results in the error "E77: Too many file names", even though the number of files is less than the value set in the tabpagemax property.

(I believe the vim -p <files> option will open in tabs, but I'm hoping to find a way to do it when vim is already open.)

link|improve this question

feedback

1 Answer

up vote 3 down vote accepted
:tab all

will open all the files in Vim's argument list in individual tabs. The argument list is initially set to the list of file names given on the command line when Vim is started. The list may be changed with the :args and related commands. See

:help :all
:help argument-list

Example:

:args *.c
:tab all

will open all the .c files in the current directory in individual tabs.

link|improve this answer
I'm not sure how this is meant to work. Say if I want to open all .txt files in the current directory, what would I enter? If I enter :tab all *.txt, vim counters with "E488: Trailing characters" – Ash Aug 4 '10 at 9:52
I edited the answer to clarify what I meant by "arguments". I meant Vim's argument list rather than arguments to :tab all. – garyjohn Aug 4 '10 at 15:39
Nice, got it now. The only thing that could make this better is a one line equivalent...what do you think the chances are? – Ash Aug 5 '10 at 0:05
I don't know of a single command that can do that, but you can put two commands on one line by separating them with a vertical bar, like this: :args *.c | tab all. – garyjohn Aug 5 '10 at 0:31
Not bad. Thanks garyjohn. – Ash Aug 5 '10 at 2:42
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.