vi / vim - how to set the tab label/title length to a fixed size in chars

:help setting-tabline

Seems to have the relevant information, but I'm not familiar enough with vim scripting to be able to help you get the exact effect you want. Hopefully someone else can pick up from this point.

Also see:

:help statusline

For some info about printing various information, that should be useful.


You can do this pretty nicely for gvim with the setting 'guitablabel'.

Here's an excerpt from my .gvimrc, which modifies the default to only show up to 12 characters of the filename, but keeps the '+' for modified buffers. The tooltip is left unmodified, so you can get the full path from that or by pressing Ctrl-G in command mode.

if version >= 700
    "set showtabline to show when more than one tab
    set showtabline=1
    "set tab labels to show at most 12 characters
    set guitablabel=%-0.12t%M
endif

" don't show the toolbar in the GUI (only the menu)
set guioptions-=T

" don't show tear-off menus
set guioptions-=t

In reply to my own question:

After reading Chad Birch above and googling for setting-tabline I found the TabLineSet plugin that does the trick, and some of script explanations here

Tags:

Vi

Vim

Tabs