On 31/03/09 17:26, Erik Falor wrote:
> On Tue, Mar 31, 2009 at 02:28:12PM +0300, Nicolas Aggelidis wrote:
[...]
> The problem was that guitablabel isn't called from within console Vim,
> so v:lnum doesn't have a valid value for the purposes of
> tabpagebuflist().
>
>> is there any way to convert it for vim?
>
> Not really.  There isn't an analog to the 'guitablabel' setting in
> console Vim.  The closest thing is 'tabline', which operates rather
> differently.  Instead of writing a function which makes one label at a
> time, in console Vim you build the tabline in one shot.
>
> Read up on it:
> :help tabline
>
> There's a nice example in the docs that you can tweak to your liking.
>

I'm using the following since that option appeared in Vim 7.00aa alpha, 
and it has suited me quite well since then:

if exists("+guioptions")
     set go-=e
endif
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

Notes:
- go-=e means this text-style tabline shall be used even in the GUI.
- The four commented-out mappings at the bottom can be included or not, 
depending on personal preferences.


Best regards,
Tony.
-- 
Being stoned on marijuana isn't very different from being stoned on
gin.
                -- Ralph Nader

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to