From 2adeef6d2cd73f2c1703db48e7c17e8f867e0b7f Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Thu, 1 Nov 2018 16:37:17 +0000 Subject: [PATCH] status line default highlighting --- vimrc | 111 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/vimrc b/vimrc index 3f09796..1152067 100644 --- a/vimrc +++ b/vimrc @@ -1197,6 +1197,8 @@ function! GetStatus(isactive) abort "{{{ let l:separator = '%#StatusLineSeparator# ' let l:normal = '%#StatusLineNormal#' let l:active = '%#StatusLineActive#' + let l:linterdash = '%#LinterDash#·' + let l:linterdashactive = '%#LinterDashActive#·' let l:statusline = l:separator "buffer number {{{ @@ -1253,26 +1255,42 @@ function! GetStatus(isactive) abort "{{{ let l:statusline.=' %{strlen(&fenc)?&fenc:&enc} ' " let l:statusline.=l:separator . l:active let l:statusline.=' %{&fileformat} ' - let l:statusline.=l:separator . l:active + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}" + " let l:statusline.=l:separator . l:active " let l:statusline.=' %{&spelllang} ' - " let l:statusline.=l:separator + let l:statusline.=l:separator endif "}}} " path/filename.extension {{{ if a:isactive - let l:statusline.='%#StatusLineDirActive# ' - let l:statusline.="%{expand('%:p:h:t')}/" - let l:statusline.='%#StatusLineFileActive#' + if &readonly + let l:statusline .= '%#StatusLineWarningActive# %r ' + let l:statusline .= '%#StatusLineFileReadOnlyActive#' + " let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + " let l:statusline.='%#StatusLineFileActive#' - let l:statusline.="%{expand('%:t:r')}" + let l:statusline.="%{expand('%:t:r')}" - let l:statusline.='%#StatusLineDotActive#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - let l:statusline.='%#StatusLineExtActive#' - let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " - let l:statusline .= '%#StatusLineWarningActive# %R ' + " let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + " let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " + else + let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + let l:statusline.='%#StatusLineFileActive#' + + let l:statusline.="%{expand('%:t:r')}" + + let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " + endif else + let l:statusline .= ' %#StatusLineFileReadOnly#%r' let l:statusline.='%#StatusLineDir# ' let l:statusline.="%{fnamemodify(expand('%:p:h'),':~')}/" let l:statusline.='%#StatusLineFile#' @@ -1283,51 +1301,51 @@ function! GetStatus(isactive) abort "{{{ let l:statusline.="%{strlen(expand('%:e'))?'.':''}" let l:statusline.='%#StatusLineExt#' let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " - let l:statusline .= '%#StatusLineWarning# %R ' endif - let l:statusline.='%*' "}}} + let l:statusline.='%*' . l:separator + " linter status {{{ if a:isactive " errors let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('error') == 0?'-':'')}" - let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" + let l:statusline .= "%#LinterErrorActive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" " style errors - let l:statusline .= '%#LinterDash#|' + let l:statusline .= l:linterdashactive let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " + let l:statusline .= "%#LinterErrorStyleActive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " " warnings let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" + let l:statusline .= "%#LinterWarningActive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" " style warnings - let l:statusline .= '%#LinterDash#|' + let l:statusline .= l:linterdashactive let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " + let l:statusline .= "%#LinterWarningStyleActive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " " info let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('info') == 0?'-':'')}" - let l:statusline .= "%#LinterInfo#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" + let l:statusline .= "%#LinterInfoActive#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" else " errors let l:statusline .= "%#LinterDash#%{(GetLinterStatus('error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorInactive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" + let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" " style errors - let l:statusline .= '%#LinterDash#|' + let l:statusline .= l:linterdash let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorStyleInactive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " + let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " " warnings let l:statusline .= "%#LinterDash#%{(GetLinterStatus('warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningInactive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" + let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" " style warnings - let l:statusline .= '%#LinterDash#|' + let l:statusline .= l:linterdash let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningStyleInactive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " + let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " " info - let l:statusline .= "%#LinterDash#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" + let l:statusline .= "%#LinterInfo#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" endif "}}} @@ -1376,21 +1394,32 @@ hi def link StatusLineDot StatusLineDir hi def link StatusLineDotActive StatusLineDirActive hi def link StatusLineExt StatusLineDir hi def link StatusLineExtActive StatusLineDirActive -" hi def link StatusLineWarning -" hi def link StatusLineWarningActive -hi def link LinterDash StatusLineNoise -" hi def link LinterDashActive -" hi def link LinterError -" hi def link LinterErrorInactive -" hi def link LinterErrorStyle -" hi def link LinterErrorStyleInactive -" hi def link LinterWarning -" hi def link LinterWarningInactive -" hi def link LinterWarningStyle -" hi def link LinterWarningStyleInactive -" hi def link LinterInfo -" hi def link Linter +hi def link StatusLineFileReadOnly StatusLineNormal +hi def link StatusLineFileReadOnlyActive WarningMsg +hi def link StatusLineWarning Normal +hi def link StatusLineWarningActive WarningMsg + +hi TESTXX guibg=#ff0000 guifg=#ffffff +hi def link Linter TESTXX + +hi def link LinterDash Normal +hi def link LinterDashActive Normal + +hi def link LinterError Normal +hi def link LinterErrorActive ErrorMsg + +hi def link LinterErrorStyle Normal +hi def link LinterErrorStyleActive SpellBad + +hi def link LinterWarning Normal +hi def link LinterWarningActive SpellCap + +hi def link LinterWarningStyle Normal +hi def link LinterWarningStyleActive LinterWarningActive + +hi def link LinterInfo Normal +hi def link LinterInfoActive SpellRare "}}} augroup status "{{{