How to open many tabs for many files in vim?

7

3

I can open one file in a new tab with:

:tabnew file

Let's say I have many files, for example: util.h and util.cpp.

How I can open those files all in separate, new tabs?

I'm looking for something similar to

:tabnew util.*

juanpablo

Posted 2012-01-14T20:40:10.750

Reputation: 5 216

Question was closed 2016-09-16T18:26:16.640

Answers

8

First, add the files as arguments:

:argadd util.*

Then use the :argdo command with :tabnew:

:argdo tabnew

You could do this with :bufadd and :bufdo but none of the buffer commands can add multiple files at the same time. Also, using the :argadd method may avoid opening tabs for files you already have open—it depends on whether you invoked Vim with multiple file arguments, or whether you have already been using the :arg* commands. (You could always do :argdel * first.)

Heptite

Posted 2012-01-14T20:40:10.750

Reputation: 16 267