About: Show tab number in your tab line   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

The following script will set up a tab label containing a "modified" indicator, the tab number, the name of the currently active buffer in the tab, and the number of windows in the tab. Drop it into your vimrc or its own file in your plugin directory. Getting the tab number is easy, it's just the "let label.=v:lnum" portion of the script, if you don't want to use the entire thing. We could have also used the tabpagenr() function, which may be required if using 'tabline' instead. Note that we CANNOT simply use %N as stated in [

AttributesValues
rdfs:label
  • Show tab number in your tab line
rdfs:comment
  • The following script will set up a tab label containing a "modified" indicator, the tab number, the name of the currently active buffer in the tab, and the number of windows in the tab. Drop it into your vimrc or its own file in your plugin directory. Getting the tab number is easy, it's just the "let label.=v:lnum" portion of the script, if you don't want to use the entire thing. We could have also used the tabpagenr() function, which may be required if using 'tabline' instead. Note that we CANNOT simply use %N as stated in [
Version
  • 7(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 1639(xsd:integer)
Category
  • Tabs
Author
  • Fritzophrenic
Subpage
  • /200911
Complexity
  • basic
Created
  • 2009(xsd:integer)
ID
  • 1640(xsd:integer)
NEXT
  • 1641(xsd:integer)
abstract
  • The following script will set up a tab label containing a "modified" indicator, the tab number, the name of the currently active buffer in the tab, and the number of windows in the tab. Drop it into your vimrc or its own file in your plugin directory. Getting the tab number is easy, it's just the "let label.=v:lnum" portion of the script, if you don't want to use the entire thing. We could have also used the tabpagenr() function, which may be required if using 'tabline' instead. Note that we CANNOT simply use %N as stated in [help setting-guitablabel], because we are returning text from a function that is called using %{...} syntax. Note, this script only works in GUI Vim, because it uses the (marginally easier) 'guitablabel' option instead of 'tabline', which would work in terminal Vim. set showtabline=2 " always show tabs in gvim, but not vim " set up tab labels with tab number, buffer name, number of windows 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 tab number let label .= v:lnum.': ' " Append the buffer name let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) if name == '' " give a name to no-name documents if &buftype=='quickfix' let name = '[Quickfix List]' else let name = '[No Name]' endif else " get only the file name let name = fnamemodify(name,":t") endif let label .= name " Append the number of windows in the tab page let wincount = tabpagewinnr(v:lnum, '$') return label . ' [' . wincount . ']' endfunction set guitablabel=%{GuiTabLabel()} Since a tab can contain multiple windows, it can be nice to see at a glance which buffers are loaded in each window in a non-current tab. There is not enough space in a tab label for this, but we can add a tooltip so that we can see what files are loaded by hovering the mouse over the tab label in question. Again, this will only work in GUI Vim. " set up tab tooltips with every buffer name function! GuiTabToolTip() let tip = '' let bufnrlist = tabpagebuflist(v:lnum) for bufnr in bufnrlist " separate buffer entries if tip!='' let tip .= " " endif " Add name of buffer let name=bufname(bufnr) if name == '' " give a name to no name documents if getbufvar(bufnr,'&buftype')=='quickfix' let name = '[Quickfix List]' else let name = '[No Name]' endif endif let tip.=name " add modified/modifiable flags if getbufvar(bufnr, "&modified") let tip .= ' [+]' endif if getbufvar(bufnr, "&modifiable")==0 let tip .= ' [-]' endif endfor return tip endfunction set guitabtooltip=%{GuiTabToolTip()}
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software