Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.)

share|improve this question
Thanks for mentioning the -p option; that's what I was looking for – user72923 Oct 21 '13 at 21:40
I found this question via Google. I was looking for how to open vim with tabs from the command line, vim -p was what I was looking for :-) – Rocket Hazmat Oct 15 '14 at 20:32
Related: How can I open multiple tabs at once? at Vim SE – kenorb Feb 23 '15 at 15:38
Related: Open several files in new tabs with VIM at Stack Overflow. – Mihai Capotă Mar 26 '15 at 15:40
Related: How to open many tabs for many files in vim? at Super User. – Mateusz Piotrowski Jan 16 at 22:48
up vote 54 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


:args *.c
:tab all

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

share|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
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
The downside is that using :tab all replaces your existing tabs. Because of this, in my use case, it doesn't provide much benefit over reopening files with vim -p. However, if there were some way to stuff existing tabs into :args, it might be possible to open new tabs and keep the existing ones. – Kevin Qi Jul 19 '12 at 23:36
If a tab is already open, substitute argadd for args. – cdosborn Jun 16 '15 at 19:17

You actually can open new tabs and keep your current tabs without writing new functions. See this answer on Stack Overflow:

:args file1 file2 | argdo tabe

You may want to open a new empty tab (:tabe) before doing that, because the first file will open in the current tab. Also, an extra empty tab will be left open (see :help argdo to understand why).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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