cut off complete file path of tabnames

55 views
Skip to first unread message

molecula21

unread,
Feb 11, 2009, 12:51:11 PM2/11/09
to vim_use
I work in a lot of different directories and i'm used to have a lot of
tabs on my vim/gvim (latest version Linux). it happens that the full
path of the current buffer being edited apears as the title of the
tab. If the path is too long it turns out very dificult to navigate
through tabs...

Is there any way to tell vim to just display the name of the file and
not the full path?

Thanks

Oleksandr Manzyuk

unread,
Feb 11, 2009, 1:14:43 PM2/11/09
to vim...@googlegroups.com
I used to have

:set guitablabel=%t

in my .vimrc, which puts the file name in the label (works in gvim only).

Regards,
Oleksandr

>
> Thanks
> >
>

molecula21

unread,
Feb 11, 2009, 1:21:42 PM2/11/09
to vim_use
Works fine on gvim! tks! Anyone does know the solution for vim?

On Feb 11, 6:14 pm, Oleksandr Manzyuk <manz...@googlemail.com> wrote:

Roberto Miura Honji

unread,
Feb 12, 2009, 6:54:16 AM2/12/09
to vim...@googlegroups.com
Try look in help setting-tabline.
With this, you can have so much type of configuration for your tab label.

2009/2/11 molecula21 <ruim...@gmail.com>



--
----------------------------------------------
Roberto Miura Honji
LAS - Laboratório de Administração e Segurança de Sistemas
Engenharia de Computação - 2006
Instituto de Computação - UNICAMP

email: miura...@gmail.com (principal)
email: ra06...@students.ic.unicamp.br
msn:   miura...@msn.com
-------------------------------------------

Tony Mechelynck

unread,
Feb 13, 2009, 12:28:35 AM2/13/09
to vim...@googlegroups.com
On 12/02/09 12:54, Roberto Miura Honji wrote:
> Try look in help setting-tabline.
> With this, you can have so much type of configuration for your tab label.

In Console Vim, or in gvim with the "e" flag not present in
'guioptions', you can define a custom 'tabline' which must take care of
all tabs, not just the current one. There's an example of custom tabline
at |setting-tabline|, here's another one:

if exists("+showtabline")
function MyTabLine()
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= '%' . i . 'T'
let s .= (i == t ? '%1*' : '%2*')
let s .= ' '
let s .= i . ':'
let s .= winnr . '/' . tabpagewinnr(i,'$')
let s .= ' %*'
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
let file = bufname(buflist[winnr - 1])
let file = fnamemodify(file, ':p:t')
if file == ''
let file = '[No Name]'
endif
let s .= file
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction
set stal=2
set tabline=%!MyTabLine()
map <F10> :tabnext<CR>
map! <F10> <C-O>:tabnext<CR>
map <S-F10> :tabprev<CR>
map! <S-F10> <C-O>:tabprev<CR>
endif


The lines between the endfunction and the last endif are optional
(except of course the ":set tabline" command).


Best regards,
Tony.
--
There is no right or wrong, there is only your personal opinion.
(Bram Moolenaar)

Reply all
Reply to author
Forward
0 new messages