Does "set guitablabel" require scripting? (Virtually all examples seem to imply that it does…)

615 views
Skip to first unread message

sfosparky

unread,
May 8, 2012, 7:32:27 PM5/8/12
to vim...@googlegroups.com
I've been trying to figure out how to change how Vim labels tabs. Everywhere I turn for information contains Vim script examples. This has led me to believe that "set guitablabel" can only be used via scripts(?)

At present, Vim labels tabs with a file name prefaced with a "path code" of the form "\P\M\M\F\R\F\R\T", where each character is the first character of a folder name on the path. Ugh!

In an effort to get rid of the path info, I tried using (without the quotation marks) ":set guitabel=%t" This has no effect.

So I went out looking for more help. But everywhere I've gone, "set guitablabel" is used within a script. Is scripting really necessary? Or is my problem that I'm formatting the ": set guitablabel" command improperly? Or?

Cheers & thanks,
Rick
SFO

Sergey Khorev

unread,
May 9, 2012, 10:09:50 AM5/9/12
to vim...@googlegroups.com
> In an effort to get rid of the path info, I tried using (without the quotation marks) ":set guitabel=%t"  This has no effect.

There is no guitabel option. As Vim help clearly says, in GUI you need
to set 'guitablabel' and in console 'tabline'. Both work perfectly
without any scripting.

Shital

unread,
May 9, 2012, 10:23:27 AM5/9/12
to vim...@googlegroups.com
yes, there is no such option for gvim, I think the Help from vim user manual will explain this, use without quotes "help guitablabel" and On usage of the command in scripts, Its not really necessary for it to be always used in scripts, You can always use the Ex Commands(commands begining with :) on the editor's commandline.

Ben Fritz

unread,
May 9, 2012, 10:23:37 AM5/9/12
to vim...@googlegroups.com
On Tuesday, May 8, 2012 6:32:27 PM UTC-5, sfosparky wrote:
> I've been trying to figure out how to change how Vim labels tabs. Everywhere I turn for information contains Vim script examples. This has led me to believe that "set guitablabel" can only be used via scripts(?)
>
> At present, Vim labels tabs with a file name prefaced with a "path code" of the form "\P\M\M\F\R\F\R\T", where each character is the first character of a folder name on the path. Ugh!
>
> In an effort to get rid of the path info, I tried using (without the quotation marks) ":set guitabel=%t" This has no effect.
>

I assume you mean 'guitablabel' instead of 'guitabel'. Are you using GUI Vim with GUI tabs enabled? See :help 'guitablabel' for the requirements, and also for details in setting it.

You don't NEED to write any script to use guitablabel or tabline options, it is just more powerful if you do. Nevertheless, you can achieve a simple tab label using only format strings like %N, %t, etc. See:

http://vim.wikia.com/wiki/Show_tab_number_in_your_tab_line

The comments section at the bottom contains a simple example without any scripting, even though the tip itself contains a lot of script. Also see :help setting-guitablabel, which includes this:


A simple example that puts the tab page number and the buffer name in the
label:
:set guitablabel=%N\ %f

sfosparky

unread,
May 9, 2012, 11:33:47 AM5/9/12
to vim...@googlegroups.com
Thanks to all. The good news is that I'm making progress. (And yes, it was just a typo — guitabel was guitablabel all along.)

OK, per the attached PNG screenshot, I'm not sure if guitablabel=%t is working properly or not. I seem to have *reduced* the long pathname in front of the file, but filenames still include a preceding path character (V\) that I'd like to get rid of.

So, is it possible to display *only* a filename in a tab? Or must one always have at least one directory/folder indicator?

Cheers & thanks again to all,
Ric
SFO
set_guitablabel01.PNG

Ben Fritz

unread,
May 9, 2012, 11:45:37 AM5/9/12
to vim...@googlegroups.com
On Wednesday, May 9, 2012 10:33:47 AM UTC-5, sfosparky wrote:
> Thanks to all. The good news is that I'm making progress. (And yes, it was just a typo — guitabel was guitablabel all along.)
>
> OK, per the attached PNG screenshot, I'm not sure if guitablabel=%t is working properly or not. I seem to have *reduced* the long pathname in front of the file, but filenames still include a preceding path character (V\) that I'd like to get rid of.
>
> So, is it possible to display *only* a filename in a tab? Or must one always have at least one directory/folder indicator?
>

Thanks for the screenshot, that clears things up.

You're correct, %t should only display the tail of the file name, with none of the path.

But you're not seeing a GUI tab pages line. You're seeing the non-GUI tabline. So, either you need to enable the GUI tab line with :set guioptions+=e, or you need to use the 'tabline' option to set the label instead.

Note that the default value of guioptions already includes the 'e' flag, so at some point in your config you must have removed it. See the output of:

:verbose set guioptions?

to see where you last set the option.

Your screenshot LOOKS like you're on a Windows system, which supports a GUI tab pages line, but note that :help 'guioptions' claims that only GTK, Motif, Mac OS/X, and Microsoft Windows support this if you're not on one of those systems.

sfosparky

unread,
May 9, 2012, 12:03:09 PM5/9/12
to vim...@googlegroups.com
Thanks so much for your help, *particularly* your most recent post. I doubt I would *ever* have figured out that there were GUI and non-GUI tabs.

So now I have a few more things to explore…

Cheers & thanks again,
Ric
SFO


>
> Thanks for the screenshot, that clears things up.
>
> You're correct, %t should only display the tail of the file name, with none of the path.
>
> But you're not seeing a GUI tab pages line. You're seeing the non-GUI tabline. So, either you need to enable the GUI tab line with :set guioptions+=e, or you need to use the 'tabline' option to set the label instead.
>
> Note that the default value of guioptions already includes the 'e' flag, so at some point in your config you must have removed it. See the output of:
>
> :verbose set guioptions?
>
> to see where you last set the option.
>
> Your screenshot LOOKS like you're on a Windows system, which supports a GUI tab pages line, but note that :help 'guioptions' claims that only GTK, Motif, Mac OS/X, and Microsoft Windows support this if you're not on one of those systems.



Reply all
Reply to author
Forward
0 new messages