If the full path of a file is very long, you can't tell which file is in a given tab. so I'm wondering is there is a way let the tab only disply the file name rather than the full path of the file, might be convenient in some case. need you help, thanks in advance.
+1
A:
Try
:set guitablabel=%t
For format of possible options see
:help 'statusline'
Habi
2010-03-18 10:21:57
+1
A:
I use this solution instead of Habi's as this one still keeps the default features of putting a '+' symbol in the tab to indicate the files being modified, as well as a count of the number of windows in the tab. So it basically works the same as the default tab labelling but just uses file names, not full paths.
" Tab headings
function GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Add '+' if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label = '+'
break
endif
endfor
" Append the number of windows in the tab page if more than one
let wincount = tabpagewinnr(v:lnum, '$')
if wincount > 1
let label .= wincount
endif
if label != ''
let label .= ' '
endif
" Append the buffer name (not full path)
return label . "%t"
endfunction
set guitablabel=%!GuiTabLabel()
David Terei
2010-04-07 05:39:21