1

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?

4
  • 1
    So the first five things shown in the tabline are buffers (i think). Once you have actual tabs open airline shows the tabs along with the title of the most recently active window; opening more buffers wont change that. sanctum.geek.nz/arabesque/buffers-windows-tabs, stackoverflow.com/questions/26708822/…, joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs ... otherwise I’m not sure I follow what your question is—you seem to want buffers to all show up in the tabline, even when using tabs?
    – D. Ben Knoble
    Commented Jun 22, 2020 at 11:18
  • @D.BenKnoble Thanks a lot dude. Your links help a lot. I misunderstood what a tab is in vim.
    – Yves
    Commented Jun 22, 2020 at 11:47
  • no problem: can you try to clarify the question? Or do you think you can write an explanatory answer?
    – D. Ben Knoble
    Commented Jun 22, 2020 at 14:19
  • @D.BenKnoble No problem :D
    – Yves
    Commented Jun 22, 2020 at 15:17

1 Answer 1

0

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:

https://sanctum.geek.nz/arabesque/buffers-windows-tabs/

https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/

1
  • Consider accepting your answer if it solved your problem
    – D. Ben Knoble
    Commented Jul 22, 2020 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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