dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 0c3cb3fca3300454545d67c979d3984cf6b0c3d1
parent 790552934668c7a1fac7d2da6e9601f304ede660
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Mon, 22 Jun 2020 12:07:09 +0200

vim: some statusline improvements, including symbols

Former-commit-id: ff548d4f5fb55f68568e04a353e981111e07b067
Diffstat:
Mvim/autoload/statusline.vim | 12++++++++----
Mvim/plugin/statusline.vim | 55++++++++++++++++++++++++++++---------------------------
2 files changed, 36 insertions(+), 31 deletions(-)

diff --git a/vim/autoload/statusline.vim b/vim/autoload/statusline.vim @@ -61,17 +61,21 @@ function! statusline#StatuslineWrapCol() return "softwrap" endif if &textwidth == 0 - return "TW ".(winwidth(0)-&wrapmargin)."(M".&wrapmargin.")" + return "⟺ ".(winwidth(0)-&wrapmargin)."(M".&wrapmargin.")" else - return "TW ".&textwidth + return "⟺ ".&textwidth endif endfunction function! statusline#StatuslineSpacesUsed() if &expandtab - return strlen(&shiftwidth) ? &shiftwidth : 'none' + return (&shiftwidth ># 0 ? &shiftwidth : &tabstop) else - return &tabstop + if &shiftwidth ==# &tabstop + return &shiftwidth + else + return &tabstop."s".&shiftwidth + endif endif endfunction diff --git a/vim/plugin/statusline.vim b/vim/plugin/statusline.vim @@ -4,33 +4,34 @@ endif let g:loaded_statusline = 1 -set laststatus=2 " Always show status bar -set statusline=%#statuslinenormmode#%{(mode()=='n')?'\ \ N\ ':''} " Normal mode indicator -set statusline+=%#DiffAdd#%{(mode()=='i')?'\ \ I\ ':''} " Insert mode indicator -set statusline+=%#DiffAdd#%{(mode()=='t')?'\ \ T\ ':''} " Insert mode indicator -set statusline+=%#DiffDelete#%{(mode()=='r')?'\ \ R\ ':''} " Replace mode indicator -set statusline+=%#Todo#%{(mode()=='v')?'\ \ V\ ':''} " Visual mode indicator -set statusline+=%#Todo#%{(mode()=='s')?'\ \ S\ ':''} " Visual mode indicator -set statusline+=%#statuslinefile#\ %f\ %* " Relative path and filename -set statusline+=%(\ %m%r%w\ %) " Flags (modified, readonly, help, preview). don't show if empty. -set statusline+=%#error# " Start error highlighting -set statusline+=%{statusline#StatuslineTabWarning()} " Inconsistent indentation warning -set statusline+=%{statusline#StatuslineTrailingSpaceWarning()} " Trailing whitespace warning -set statusline+=%* " Clear highlighting -set statusline+=%= " Move everything after this to the right -set statusline+=%< " Start truncating here -set statusline+=\ %{statusline#StatuslineBuildCwd()}\ " Current working directory, replacing home with ~ -set statusline+=%#statuslinefile# " Highlight same as filename -set statusline+=%(\ %{&spell?'[spell]\ ':''}%) " Show spellcheck status -set statusline+=%(\ %{statusline#StatuslineVimtexCompiler()}%) -set statusline+=\ %y " File type -set statusline+=\ [%{&expandtab?'spaces':'tabs'}, " Using spaces or tabs -set statusline+=%{statusline#StatuslineSpacesUsed()}] " Spaces in a tab -set statusline+=\ {%{statusline#StatuslineWrapCol()}} " Textwidth/wrapmargin info -set statusline+=\ %#statuslinenormmode# " Highlight same as normal mode indicator -set statusline+=\ [%{statusline#StatuslineFoldmethod()}] " The current foldlevel -set statusline+=\ %l/%L\ " Cursor line/total lines -set statusline+=\ %{strftime(\"%H:%M\")}\ " Time +set laststatus=2 " Always show status bar +set statusline=%#statuslinenormmode#%{(mode()=='n')?'\ \ N\ ':''} " Normal mode indicator +set statusline+=%#DiffAdd#%{(mode()=='i')?'\ \ I\ ':''} " Insert mode indicator +set statusline+=%#DiffAdd#%{(mode()=='t')?'\ \ T\ ':''} " Insert mode indicator +set statusline+=%#DiffDelete#%{(mode()=='r')?'\ \ R\ ':''} " Replace mode indicator +set statusline+=%#Todo#%{(mode()=='v')?'\ \ V\ ':''} " Visual mode indicator +set statusline+=%#Todo#%{(mode()=='s')?'\ \ S\ ':''} " Select mode indicator +set statusline+=%#statuslinefile#\ %f " Relative path and filename +set statusline+=\ 〉%* " Separator and clear highlighting +set statusline+=%(\ %m%r%w\ %) " Flags (modified, readonly, help, preview). don't show if empty. +set statusline+=%#error# " Start error highlighting +set statusline+=%(%{statusline#StatuslineTabWarning()}%) " Inconsistent indentation warning +set statusline+=%(%{statusline#StatuslineTrailingSpaceWarning()}%) " Trailing whitespace warning +set statusline+=%* " Clear highlighting +set statusline+=%= " Move everything after this to the right +set statusline+=%< " Start truncating here +set statusline+=\ %{statusline#StatuslineBuildCwd()}\ " Current working directory, replacing home with ~ +set statusline+=%#statuslinefile# " Highlight same as filename +set statusline+=%(\ %{&spell?'📖\ ':''}%) " Show spellcheck status +set statusline+=%(\ %{statusline#StatuslineVimtexCompiler()}%) " Vimtex compiler status +set statusline+=%(\ %y\ \|%) " File type +set statusline+=\ %{&expandtab?'⤻':'⥅'}\ " Using spaces or tabs +set statusline+=%{statusline#StatuslineSpacesUsed()} " Spaces in a tab +set statusline+=\ \|\ %{statusline#StatuslineWrapCol()}\ " Textwidth/wrapmargin info +set statusline+=\ %#statuslinenormmode# " Highlight same as normal mode indicator +set statusline+=\ [%{statusline#StatuslineFoldmethod()}] " The current foldlevel +set statusline+=\ %l/%L\ " Cursor line/total lines +set statusline+=\ %{strftime(\"%H:%M\")}\ " Time augroup statusline " recalculate the tab/trailing whitespace warning flags when idle and after writing