Why does `:tab all` open most files in new tabs and some in a one tab split horizontally?

I want to open all the files from the current directory matching *.c.

I do it using

:args *.c
:tab all

However my vim opens the first nine files in new tabs and the last six in the last tab and splits them horizontally.

I’ve tried to use commands like :tabnew instead of :tab but they require a single file – I don’t know how to solve my problem using those.

My questions are:

  • How can I quickly open many files the way every file has its own tab? Maybe it is possible to disable splitting?
  • Why does :tab behaves this way?

Multiple files in one tab

Answer

Actually, there is a way to do it according to this answer:

:args *.c | argdo tabe

Works perfectly. It will probably close all your other tabs though. Click here if you want to learn more.

When it comes to the weird behaviour of :tab it turns out that there is a variable tabpagemax which is set to 10 by default (see :h tabepagemax). This explains everything.

You can find out what is the value of variables in vim using :set foo? where foo is the variable you are looking for.

Here are some references I’ve come by:

Attribution
Source : Link , Question Author : Mateusz Piotrowski , Answer Author : Community

Leave a Comment