Robert
Robert

Reputation: 39

Open Many Files (Over 10) in Separate Tabs at Once in Vim

I have noticed that when I try to open many files in vim with the -p command, only about 8 or 9 of them actually open. Can I change this to make more open?

Upvotes: 2

Views: 1114

Answers (1)

mattb
mattb

Reputation: 3062

from :help -p:

-p[N]    Open N tab pages.  If [N] is not given, one tab page is opened
         for every file given as argument.  The maximum is set with
         'tabpagemax' pages (default 10).  If there are more tab pages
         than arguments, the last few tab pages will be editing an
         empty file.  Also see |tabpage|.

So in your .vimrc do e.g. set tabpagemax=99

Note

You say that 'only about 8-9 of them actually open' but this is not true: it's just that they didn't open in separate tab pages. If you do :buffers (or :files or :ls) you'll see all the documents did open, and that each one belongs to a separate 'buffer'. It is very useful to grasp the concept of buffers vs tabs vs windows in vim, since most other editing environments use tab pages in the same way that vim uses buffers...

See :help 22.4 and :help windows and :help tabpage to sort out how they relate to each other. Also see this blog post that lays out the differences well and this stack answer that goes into more details about the motivation behind buffers, windows and tabs in vim.

This is the basic picture to understand:

Summary:
    A buffer is the in-memory text of a file.
    A window is a viewport on a buffer.
    A tab page is a collection of windows.

Image taken from here

Upvotes: 8

Related Questions