I'm using the plugins Nerdtree and Airline in my vim. Here is my config:

autocmd VimEnter * NERDTree
autocmd BufWinEnter * NERDTreeMirror    " make Nerdtree available on each tab
let g:airline_theme='sol'
let g:airline#extensions#ycm#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#buffer_idx_mode = 1

When I execute vim, I can navigate files on the original tab as expected. For example, I opened five files with the help of Nerdtree on the original tab and then I could see the tabline as below:

enter image description here

Then, I press t on some file in Nerdtree to open a new tab. On this new tab, there are two unexpected things:

  1. I can see the name of Nerdtree is shown on the tabline, which isn't shown on the first tab.

  2. No matter how many different files I try to open, there is always only one filename is shown on the tabline, meaning that the new filename will replace the old one.

enter image description here

In a word, I want the new tab (created by pressing t in Nerdtree) to act just like the first one.

How to achieve this?


With the help of D. Ben Knoble, I finally figured it out.

The problem is that I regarded the tabs managed by Airline and the tabs managed by Nerdtree as the same thing, which is not true.

If I want to use Airline to manage tabs, I shouldn't press t in Nerdtree to open another tabs. Meaning that, when we enable the tabline of Airline, we simply need to open files one by one through Nerdtree as normal.

The links below may be helpful:



  • Consider accepting your answer if it solved your problem
    – D. Ben Knoble
    Jul 22 '20 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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