aboutsummaryrefslogtreecommitdiff
path: root/.local/share/nvim/site/autoload/statusbar.vim
diff options
context:
space:
mode:
Diffstat (limited to '.local/share/nvim/site/autoload/statusbar.vim')
-rw-r--r--.local/share/nvim/site/autoload/statusbar.vim68
1 files changed, 56 insertions, 12 deletions
diff --git a/.local/share/nvim/site/autoload/statusbar.vim b/.local/share/nvim/site/autoload/statusbar.vim
index 59e63f5..4dc8e31 100644
--- a/.local/share/nvim/site/autoload/statusbar.vim
+++ b/.local/share/nvim/site/autoload/statusbar.vim
@@ -1,20 +1,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 ',
+ \ 'n' : 'NORMAL',
+ \ 'v' : 'VISUAL',
+ \ 'V' : 'V·Line',
+ \ "\<C-V>" : 'V·Block',
+ \ 'i' : 'INSERT',
+ \ 'R' : 'R',
+ \ 'Rv' : 'V·Replace',
+ \ 'c' : 'Command',
\}
set statusline=
- set statusline+=\ %{toupper(g:currentmode[mode()])}
- set statusline+=%=
- set statusline+=\ %f
+ set statusline+=%#StatusLineBlock#\ %{toupper(g:currentmode[mode()])}%#StatusLine#
+ set statusline+=\ %#StatusLine#%#StatusLineBlock#%f%#StatusLine#
set statusline+=%=
- set statusline+=\ %l/%L\ %p%%\
+ set statusline+=%#StatusLine#%#StatusLineBlock#%l/%L\ %p%%\
+
+ set tabline=%!TabLine()
endfunction