Say I have a bunch of tabs open in Vim, with a tabline looks something like this:

1 v/file1.py 2 t/file.py 1 t/file.py 1 o/otherfile.py

See how two tabs both say "t/file.py"? Those are different files, they just get turned into the same tab label.

In my workflow the tab titles are often ambiguous (yay for Chef naming everything "default.rb") or unhelpful ("I know one of these 8 tabs with 4 buffers each has that file I'm looking for...").

I'd like to rename the tabs to indicate what they logically represent:

1 homepage_view 2 tests 1 homepage_template 1 o/otherfile.py

I'm fine with tabs defaulting to a filename-based label, as long as I'm free to change it once the tab is created.

How can I do this in Vim?

  • 1
    I do not have time to experiment right now, but see :help setting-tabline (for vim in a terminal) or :help setting-guitablabel (for gvim). You could write a function that checks for a tab-local variable and returns either that or some default. Then, after opening a tab, :let t:mytablabel = 'homepage_template'. Feb 12, 2014 at 19:28
  • This answer may be helpful, but Vimscript knowledge is required, and it is not helpful if you simply want to add a static label to the tab title provided by the default Vim behaviour (i.e., + for modified buffer, truncating filenames, etc.). (Which is what I need, hence this question.)
    – toraritte
    Oct 8, 2022 at 10:13

2 Answers 2


There's a nice little plugin called Taboo that makes this easy. Just install it and then you can change the tab title with:

:TabooRename My Tab Title

You can look at the source code for that plugin if you're interested in writing your own solution.

  • 3
    Taboo is fantastic. TabooReset and TabooRename literally toggles two "modes" of the Tab-line ==> a named tab by Taboo, and an auto-named tab by Vim. This replicates the "named Windows" from Tmux perfectly. Better still, tabs named under Taboo can be restored using Startify (or under any other session-saving tools).
    – llinfeng
    Nov 30, 2019 at 3:33

For gvim, see

:help 'guitablabel'
:help setting-guitablabel

Set the option to an expression that evaluates to t:mytablabel (a tab-local variable) if it exists, or else to an empty string (meaning to use the default):

:set guitablabel=%{exists('t:mytablabel')?t:mytablabel\ :''}

Maybe that is already too complicated, or maybe you want to get fancier. In that case, define a function:

function! GuiTabLabel()
  return exists('t:mytablabel') ? t:mytablabel : ''
:set guitablabel=%{GuiTabLabel()}
:set go+=e

Then, in any tab where you want to override the default, do something like

:let t:mytablabel = 'homepage_template'

If you are using vim in a terminal, not gvim, then you have to set the 'tabline' option instead of 'guitablable'. This is a little more complicated, since you need a single expression that includes labels for all the open tabs. There is a complete example under

:help setting-tabline

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .