Vi and Vim Asked on November 27, 2021
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:
Then, I press t
on some file in Nerdtree to open a new tab. On this new tab, there are two unexpected things:
I can see the name of Nerdtree is shown on the tabline, which isn’t shown on the first tab.
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.
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:
https://sanctum.geek.nz/arabesque/buffers-windows-tabs/
https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/
Answered by Yves on November 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP