dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

vim-tabline.vim (1108B)


      1 if (exists("g:loaded_tabline_vim") && g:loaded_tabline_vim) || &cp
      2     finish
      3 endif
      4 let g:loaded_tabline_vim = 1
      5 
      6 function! Tabline()
      7     let s = ''
      8     let d = expand('%:~:h')
      9     let d = pathshorten(d)
     10     for i in range(tabpagenr('$'))
     11         let tab         = i + 1
     12         let winnr       = tabpagewinnr(tab)
     13         let buflist     = tabpagebuflist(tab)
     14         let bufnr       = buflist[winnr - 1]
     15         let bufname     = bufname(bufnr)
     16         let bufmodified = getbufvar(bufnr, "&mod")
     17 
     18         let s .= '%' . tab . 'T'
     19         let s .= (tab == tabpagenr() ? '%#TabLineNumSel#' : '%#TabLineNum#')
     20         let s .= ' ' . tab . ' '
     21         let s .= (tab == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#')
     22         let s .= ' '
     23         let s .= (bufname != '' ? fnamemodify(bufname, ':t') . ' ' : '[No Name] ')
     24 
     25         if bufmodified
     26             let s .= '[+] '
     27         endif
     28 
     29         let s .= '%#TabLineFill# '
     30     endfor
     31 
     32     let s .= '%=%999%'
     33     let s .= '%#TabLineSep#'
     34     let s .= ''
     35     let s .= '%#TabLineDir#'
     36     let s .= ' ' . d . ' '
     37 
     38     return s
     39 endfunction
     40 set tabline=%!Tabline()