Loading ...
Sorry, an error occurred while loading the content.

Re: Rename a single tab?

Expand Messages
  • Israel
    Hi there, ... Even simpler: function! MyLabel() if exists( t:name ) return t:name else return endif endfunction set guitablabel=%{MyLabel()} ... -- You
    Message 1 of 5 , Sep 10, 2010
    • 0 Attachment
      Hi there,

      On Apr 10 2008, 12:12 pm, Bill Mill <bill.m...@...> wrote:
      > Simpler:
      >
      > function! MyLabel(n)
      >   if exists('t:name')
      >     return t:name
      >   else
      >     return ''
      >   endif
      > endfunction
      >
      > function! MyGuiTabLine()
      >  let s = '%{MyLabel(' . tabpagenr() . ')}'
      >  return s
      > endfunction
      >
      > set guitablabel=%!MyGuiTabLine()
      >
      > -Bill

      Even simpler:

      function! MyLabel()
      if exists('t:name')
      return t:name
      else
      return ''
      endif
      endfunction

      set guitablabel=%{MyLabel()}

      >
      > On Apr 10, 12:38 pm, Bill  Mill <bill.m...@...> wrote:
      >
      > > On Apr 10, 11:46 am, Bem Jones-Bey <b...@...> wrote:
      >
      > > > Bill Mill wrote:
      >
      > > > I don't know how to set a label just for a single tab, however, if you
      > > > want to set a variable, you need to use let instead of set. (Set sets an
      > > > option, and let sets a variable).
      >
      > > > Hope that helps.
      >
      > > Thanks - I'm a lot closer now. This mostly works, except it doesn't
      > > change the tab name until you switch tabs:
      >
      > > function! MyLabel(n)
      > >   if exists('t:name')
      > >     return t:name
      > >   else
      > >     let buflist = tabpagebuflist(a:n)
      > >     let winnr   = tabpagewinnr(a:n)
      > >     let bufnam  = bufname(buflist[winnr - 1])
      > >     " This is getting the basename() of bufname above
      > >     let base    = substitute(bufnam, '.*/', '', '')
      > >     return base
      > >   endif
      > > endfunction
      >
      > > function! MyGuiTabLine()
      > >  let s = ' %{MyLabel(' . tabpagenr() . ')} '
      > >  return s
      > > endfunction
      >
      > > set guitablabel=%!MyGuiTabLine()
      >
      > > Is there any way to have the tab label refresh as soon as you "let
      > > t:name="something""?
      >
      > > -Bill

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.