function TabLabel(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) return fnamemodify(bufname(buflist[winnr - 1]), ':t') endfunction function! TabLine() let s = '' for i in range(tabpagenr('$')) let s ..= '%#TabLineFill# ' " set the tab page number (for mouse clicks) let s ..= '%' .. (i + 1) .. 'T' " select the highlighting if i + 1 == tabpagenr() let s ..= '%#TabLineSel# ' else let s ..= '%#TabLine# ' endif " the label is made by TabLabel() if TabLabel(i + 1) == "" let s ..= "No Name" else let s ..= TabLabel(i + 1) endif let s ..= " %" .. (i + 1) .. "X" 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' return s endfunction function! ModeLabel() let currentmode={ \ 'n' : 'NORMAL', \ 'v' : 'VISUAL', \ 'V' : 'V·Line', \ "\" : 'V·Block', \ 'i' : 'INSERT', \ 'R' : 'R', \ 'Rv' : 'V·Replace', \ 'c' : 'Command', \ 's' : 'Snipped', \ 't' : 'Terminal', \} return get(currentmode, mode(), '') endfunction function! statusbar#refresh() set laststatus=3 set statusline= set statusline+=%#StatusLineBlock#\ %{ModeLabel()}\ %#StatusLine#" set statusline+=\ %#StatusLine#%#StatusLineBlock#\ %f\ %#StatusLine# set statusline+=%= set statusline+=%#StatusLine#%#StatusLineBlock#\ %l/%L\ %p%%\ set tabline=%!TabLine() endfunction