commit 9861316da970521464b41693d92d0067937561c3
parent 4bd564b132be18ef07641d477b48a0227187bd47
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Wed, 15 Apr 2020 17:26:45 +0200
vim: statusline mode indicator + optional word count
Former-commit-id: 70d9f16b779c53503d058fe8f7692af7b99a91ee
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/vim/autoload/statusline.vim b/vim/autoload/statusline.vim
@@ -74,3 +74,7 @@ function! statusline#StatuslineSpacesUsed()
return &tabstop
endif
endfunction
+
+function! statusline#StatuslineWordCount()
+ return wordcount().words . " words"
+endfunction
diff --git a/vim/plugin/statusline.vim b/vim/plugin/statusline.vim
@@ -5,7 +5,13 @@ endif
let g:loaded_statusline = 1
set laststatus=2 " Always show status bar
-set statusline=%f " Relative path and filename
+set statusline= " Init statusline
+set statusline+=%#DiffChange#%{(mode()=='n')?'\ \ N\ ':''} " Normal mode indicator
+set statusline+=%#DiffAdd#%{(mode()=='i')?'\ \ I\ ':''} " Insert mode indicator
+set statusline+=%#DiffDelete#%{(mode()=='r')?'\ \ R\ ':''} " Replace mode indicator
+set statusline+=%#Todo#%{(mode()=='v')?'\ \ V\ ':''} " Visual mode indicator
+set statusline+=%* " Clear highlighting
+set statusline+=\ %f " Relative path and filename
set statusline+=\ %m%r%w " Flags (modified, readonly, help, preview)
set statusline+=%#error# " Start error highlighting
set statusline+=%{statusline#StatuslineTabWarning()} " Inconsistent indentation warning