commit a7614a3d39ee3ef2933dbdc94214a2aecf1aa153
parent e47da54f1f177ad75d2f760efe2ad738db9b83ad
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Mon, 13 Jan 2020 14:30:05 +0100
vim: add more info to statusline
Former-commit-id: 561c06c1619025d8fedffb2c2c62a30c357ee84a
Diffstat:
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/vim/autoload/statusline.vim b/vim/autoload/statusline.vim
@@ -44,10 +44,20 @@ function! statusline#StatuslineBuildCwd()
return "CWD: " . cwd
endfunction
+" get the current fold info
function! statusline#StatuslineFoldmethod()
if &foldmethod == "indent"
- return "[z".&foldlevel.",c".foldlevel(line('.'))."]"
+ return "z".&foldlevel.",c".foldlevel(line('.'))
else
- return ""
+ return "f:".strpart(&foldmethod, 0, 4)
+ endif
+endfunction
+
+" print the textwrap information (textwidth or wrapmargin)
+function! statusline#StatuslineWrapCol()
+ if &textwidth == 0
+ return "TW ".(winwidth(0)-&wrapmargin)."(M".&wrapmargin.")"
+ else
+ return "TW ".&textwidth
endif
endfunction
diff --git a/vim/vimrc b/vim/vimrc
@@ -420,13 +420,13 @@ set statusline+=%* " Clear high
set statusline+=%< " Start truncating here
set statusline+=\ \ %{statusline#StatuslineBuildCwd()} " Current working directory, replacing home with ~
set statusline+=%= " Move everything after this to the right
-set statusline+=\ %y " File type
+set statusline+=%y " File type
set statusline+=\ [%{&expandtab?'spaces':'tabs'}, " Using spaces or tabs
set statusline+=%{strlen(&shiftwidth)?&shiftwidth:'none'}] " Spaces in a tab
-set statusline+=\ %{statusline#StatuslineFoldmethod()} " The current foldlevel
+set statusline+=\ [%{statusline#StatuslineFoldmethod()}] " The current foldlevel
+set statusline+=\ {%{statusline#StatuslineWrapCol()}} " Textwidth/wrapmargin info
set statusline+=\ %l/%L\ " Cursor line/total lines
-set statusline+=\ B%n " Buffer number
-set statusline+=\ \ %{strftime(\"%H:%M\")} " Time
+set statusline+=\ %{strftime(\"%H:%M\")}\ " Time
" Conditional foldlevel display
augroup statusline