dotfiles

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

commit 8826f506b7131ccac11bbf93a85ccc972d6567e4
parent 54d9907e46230efefa8d7da57f1803b0756cac44
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Thu, 30 Apr 2020 16:26:37 +0200

vim: statusline improvements

Got inspired by papercolor colors, decided to make the statusline a bit cleaner.


Former-commit-id: 347635e5b05283980ab373408ec625685ce062ff
Diffstat:
Mvim/autoload/statusline.vim | 2+-
Mvim/colors/jokull.schemer | 6++++--
Mvim/colors/jokull.vim | 8+++++---
Mvim/plugin/statusline.vim | 48++++++++++++++++++++++++------------------------
4 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/vim/autoload/statusline.vim b/vim/autoload/statusline.vim @@ -41,7 +41,7 @@ endfunction " build the current working directory string function! statusline#StatuslineBuildCwd() let cwd = substitute(getcwd(),$HOME,'~','g') - return "CWD: " . cwd + return "(".cwd.")" endfunction " get the current fold info diff --git a/vim/colors/jokull.schemer b/vim/colors/jokull.schemer @@ -37,10 +37,12 @@ Preproc NONE Vertsplit NONE Todo justblue, justyellow Nontext #81A1C1 -StatusLine NONE, #4aaecd -Statuslinenc NONE, lightblue +StatusLine offwhite, #005f87 +Statuslinenc offwhite, #0087af StatusLineTermNC NONE, midgreen StatusLineTerm NONE, darkergreen +StatusLineFile offwhite, #0087af +StatusLineNormMode #0087af, #d0d0d0. Visual NONE, #a8caff Title #225555. bold Matchparen lightgreen, lightblue diff --git a/vim/colors/jokull.vim b/vim/colors/jokull.vim @@ -26,10 +26,12 @@ hi Preproc guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE cterm=NONE gui=NONE hi Vertsplit guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE cterm=NONE gui=NONE hi Todo guifg=#0000FF guibg=#FFFF00 ctermfg=21 ctermbg=11 cterm=NONE gui=NONE hi Nontext guifg=#81A1C1 guibg=NONE ctermfg=109 ctermbg=NONE cterm=NONE gui=NONE -hi StatusLine guifg=NONE guibg=#4aaecd ctermfg=NONE ctermbg=74 cterm=NONE gui=NONE -hi Statuslinenc guifg=NONE guibg=#a8dbfd ctermfg=NONE ctermbg=153 cterm=NONE gui=NONE +hi StatusLine guifg=#e5e5e5 guibg=#005f87 ctermfg=7 ctermbg=24 cterm=NONE gui=NONE +hi Statuslinenc guifg=#e5e5e5 guibg=#0087af ctermfg=7 ctermbg=31 cterm=NONE gui=NONE hi StatusLineTermNC guifg=NONE guibg=#99FF77 ctermfg=NONE ctermbg=120 cterm=NONE gui=NONE hi StatusLineTerm guifg=NONE guibg=#009051 ctermfg=NONE ctermbg=29 cterm=NONE gui=NONE +hi StatusLineFile guifg=#e5e5e5 guibg=#0087af ctermfg=7 ctermbg=31 cterm=NONE gui=NONE +hi StatusLineNormMode guifg=#0087af guibg=#d0d0d0 ctermfg=31 ctermbg=252 cterm=NONE gui=NONE hi Visual guifg=NONE guibg=#a8caff ctermfg=NONE ctermbg=153 cterm=NONE gui=NONE hi Title guifg=#225555 guibg=NONE ctermfg=23 ctermbg=NONE cterm=bold gui=bold hi Matchparen guifg=#d7f1e0 guibg=#a8dbfd ctermfg=194 ctermbg=153 cterm=NONE gui=NONE @@ -83,7 +85,7 @@ hi! link operator statement hi! link vimwikilink type hi! link specialchar delimiter " Code to clear any groups that are not defined -let s:DefinedColors=['precondit', 'tag', 'spellocal', 'conditional', 'markdowncode', 'netrwdir', 'netrwexe', 'tabline', 'mkdlink', 'signcolumn', 'spellcap', 'spellrare', 'netrwmarkfile', 'markdownurl', 'error', 'spellbad', 'number', 'define', 'typedef', 'storageclass', 'specialcomment', 'pmenu', 'macro', 'pmenusel', 'modemsg', 'character', 'repeat', 'debug', 'special', 'label', 'operator', 'vimwikilink', 'specialchar', 'normal', 'cursorline', 'string', 'identifier', 'function', 'statement', 'include', 'type', 'search', 'incsearch', 'folded', 'tablinefill', 'tablinesel', 'wildmenu', 'linenr', 'preproc', 'vertsplit', 'todo', 'nontext', 'statusline', 'statuslinenc', 'statuslinetermnc', 'statuslineterm', 'visual', 'title', 'matchparen', 'qffilename', 'delimiter', 'comment', 'errormsg', 'cursorlinenr', 'specialkey', 'constant', 'diffadd', 'diffdelete', 'diffchange', 'diftext', 'gitgutteradd', 'gitgutterchange', 'gitgutterdelete', 'gitgutterchangedelete'] +let s:DefinedColors=['precondit', 'tag', 'spellocal', 'conditional', 'markdowncode', 'netrwdir', 'netrwexe', 'tabline', 'mkdlink', 'signcolumn', 'spellcap', 'spellrare', 'netrwmarkfile', 'markdownurl', 'error', 'spellbad', 'number', 'define', 'typedef', 'storageclass', 'specialcomment', 'pmenu', 'macro', 'pmenusel', 'modemsg', 'character', 'repeat', 'debug', 'special', 'label', 'operator', 'vimwikilink', 'specialchar', 'normal', 'cursorline', 'string', 'identifier', 'function', 'statement', 'include', 'type', 'search', 'incsearch', 'folded', 'tablinefill', 'tablinesel', 'wildmenu', 'linenr', 'preproc', 'vertsplit', 'todo', 'nontext', 'statusline', 'statuslinenc', 'statuslinetermnc', 'statuslineterm', 'statuslinefile', 'statuslinenormmode', 'visual', 'title', 'matchparen', 'qffilename', 'delimiter', 'comment', 'errormsg', 'cursorlinenr', 'specialkey', 'constant', 'diffadd', 'diffdelete', 'diffchange', 'diftext', 'gitgutteradd', 'gitgutterchange', 'gitgutterdelete', 'gitgutterchangedelete'] function! s:ClearUndefinedColors(colors) let undefined_groups = filter(a:colors->keys()->map('tolower(v:val)'), 'index(s:DefinedColors, tolower(v:val)) < 0') call map(undefined_groups, "execute('highlight' . ' ' . v:val . ' ' . 'NONE')") diff --git a/vim/plugin/statusline.vim b/vim/plugin/statusline.vim @@ -4,30 +4,30 @@ endif let g:loaded_statusline = 1 -set laststatus=2 " Always show status bar -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 -set statusline+=%{statusline#StatuslineTrailingSpaceWarning()} " Trailing whitespace warning -set statusline+=%* " Clear highlighting -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+=%{&spell?'[spell]\ ':''} " Show spellcheck status -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#StatuslineFoldmethod()}] " The current foldlevel -set statusline+=\ {%{statusline#StatuslineWrapCol()}} " Textwidth/wrapmargin info -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+=%#DiffDelete#%{(mode()=='r')?'\ \ R\ ':''} " Replace mode indicator +set statusline+=%#Todo#%{(mode()=='v')?'\ \ V\ ':''} " 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+=\ %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 augroup statusline " recalculate the tab/trailing whitespace warning flags when idle and after writing