Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 693
Robert Avatar asked Oct 27 '25 15:10

Robert


1 Answers

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

like image 138
mattb Avatar answered Oct 29 '25 07:10

mattb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!