" Rename tabs to show tab number. " based on: " http://stackoverflow.com/questions/5927952/whats-implementation-of-vims-default-tabline-function function! MyTabLine() "{{{ let l:customtabline = '' let l:currenttabnum = tabpagenr() let l:lasttabnumber = tabpagenr('$') let l:tabnumber = 1 while l:tabnumber <= l:lasttabnumber let l:buflist = tabpagebuflist(l:tabnumber) let l:winnr = tabpagewinnr(l:tabnumber) if l:lasttabnumber > 1 let l:customtabline .= '%' . l:tabnumber . 'T' let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%1*' : '%2*') let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineNumSel#' : '%#TabLineNum#') let l:customtabline .= ' ' . l:tabnumber . ' ' let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineItemSel#' : '%#TabLineItem#') endif let l:bufnr = l:buflist[l:winnr - 1] let l:file = bufname(l:bufnr) let l:buftype = getbufvar(l:bufnr, '&buftype') if l:buftype ==# 'help' let l:file = 'help:' . fnamemodify(l:file, ':t:r') elseif l:buftype ==# 'quickfix' let l:file = 'quickfix' elseif l:buftype ==# 'nofile' if l:file =~# '\/.' let l:file = substitute(l:file, '.*\/\ze.', '', '') endif else let l:file = fnamemodify(l:file, ':p:t') endif if l:file ==# '' let l:file = "''" endif let l:customtabline .= l:file . ' ' let l:tabnumber = l:tabnumber + 1 endwhile let l:customtabline .= '%T%#TabLineFill#%=' if exists('*gutentags#statusline') let l:customtabline .= '%#TabLineItemSel# %{gutentags#statusline("[ ", " ☢ ] ")}' endif let l:customtabline .= '%#TabLineItem# %{getcwd()}% ' if exists('*fugitive#statusline') let l:customtabline .= '%#TabLineItem# %{fugitive#statusline()}% ' endif if exists('*ObsessionStatus') let l:customtabline .= "%#TabLineItemSel# %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} %*" endif return l:customtabline endfunction "}}} set tabline=%!MyTabLine() hi def link TabLineItem TabLine hi def link TabLineItemSel TabLineSel hi def link TabLineNum TabLine hi def link TabLineNumSel TabLineSel