function TabLabel(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) return bufname(buflist[winnr - 1]) endfunction function! TabLine() let s = '' for i in range(tabpagenr('$')) " select the highlighting if i + 1 == tabpagenr() let s ..= '%#TablineC#%#TabLineSel#' else let s ..= ' %#TabLine#' endif " set the tab page number (for mouse clicks) let s ..= '%' .. (i + 1) .. 'T' " the label is made by MyTabLabel() let s ..= '%{TabLabel(' .. (i + 1) .. ')}' if i + 1 == tabpagenr() let s ..= '%#StatusLine#%#TabLine#' else let s ..= ' ' endif endfor " after the last tab fill with TabLineFill and reset tab page nr let s ..= '%#TabLineFill#%T' " right-align the label to close the current tab page if tabpagenr('$') > 1 let s ..= '%=%#TablineC#%#TabLineSel#%999X ' endif return s endfunction function! statusbar#refresh() set laststatus=3 let g:currentmode={ \ 'n' : 'NORMAL', \ 'v' : 'VISUAL', \ 'V' : 'V·Line', \ "\" : 'V·Block', \ 'i' : 'INSERT', \ 'R' : 'R', \ 'Rv' : 'V·Replace', \ 'c' : 'Command', \} set statusline= set statusline+=%#StatusLineBlock#\ %{toupper(g:currentmode[mode()])}%#StatusLine# set statusline+=\ %#StatusLine#%#StatusLineBlock#%f%#StatusLine# set statusline+=%= set statusline+=%#StatusLine#%#StatusLineBlock#%l/%L\ %p%%\ set tabline=%!TabLine() endfunction