How do I change the name of Nerdtree tab in the powerline where it displays filename

Rightnow it displays it as ~/dir/dir/NERD_tree_1

I just want it to be displayed Nerd Tree

  • Have you had any luck with the answer I posted? It should be exactly what you need (except, perhaps, for a tweak to the substitution pattern).
    – B Layer
    Commented Sep 23, 2017 at 9:34
  • @BLayer I tried changing patterns, it didn't work Commented Sep 24, 2017 at 13:18
  • What do you currently see when you do :echo g:airline#extensions#tabline#fnamemod ?
    – B Layer
    Commented Sep 24, 2017 at 14:11
  • It says undefined variable for some reason. Does it have to do that I have powerline installed and not airline? Commented Sep 24, 2017 at 14:14
  • Oh, shoot, man...I screwed up...mixed the two up! (I use both.) Sorry about that. I'll look for a solution for powerline.
    – B Layer
    Commented Sep 24, 2017 at 14:16

1 Answer 1


Looking at the documentation and code I don't see any straightforward way to do customization like that. There are some basic modifications that can be done to the directory portion of the path and the file part but we're talking about basic things like converting /home/foo.bar/ to ~foo.bar.

But are you sure you're actually using Powerline for your tabline? Because it is configured with the 'tabline' setting and you said yours was not set to anything. As you can see near the end of this code Powerline writes to that setting if tabline is configured.

Either way there are no easy solutions.

  • If you are using Powerline for your tabline then you could modify the code I linked to above (e.g. by looking for the Nerd Tree filename and doing some substitution).

  • If you are not using Powerline for your tabline then you can modify 'tabline' per :help setting-tabline but some of the text in that helpfile might dissuade you:

The 'tabline' option allows you to define your preferred way to tab pages labels. This isn't easy.

Even with the example they provide you're facing a challenge as it does not show how to bring the back the complete set of features enabled by the default tabline settings.

TBH, your best bet, if you really want to change this, is to switch to vim-airline. You can fully modify paths via the :airline#extensions#tabline#fnamemod variable. I've used both and I prefer airline. It's much more lightweight (pure Vim, no Python) but still has everything I want and looks great. Even Powerline's docs mention this as a good alternative:

You should check out some of the Powerline derivatives. The most lightweight and feature-rich alternative is currently Bailey Ling’s vim-airline project.

  • I shifted to airline .. Thanks for the tips Commented Sep 30, 2017 at 12:46
  • Good choice.. You're welcome.
    – B Layer
    Commented Sep 30, 2017 at 12:59

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.