blob: 4dc8e314a064d1b57f7cc77a4e1f77626b69d0c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
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',
\ "\<C-V>" : '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
|