proper highlight classes for linter status

This commit is contained in:
ManjaroOne666 2018-03-18 15:59:32 +00:00
parent 69eba69fe8
commit 6cea018f11
1 changed files with 33 additions and 23 deletions

View File

@ -11,14 +11,14 @@ function! GetStatus(isactive) "{{{
let l:statusline = '' let l:statusline = ''
" file percentage " file percentage
let l:statusline .= '%#FoldColumn#┼ ' let l:statusline .= '%#FoldColumn#┼ ' "{{{
if a:isactive if a:isactive
let l:statusline .= '%#StatusLinePercentActive#' let l:statusline .= '%#StatusLinePercentActive#'
else else
let l:statusline .= '%#StatusLinePercent#' let l:statusline .= '%#StatusLinePercent#'
endif endif
let l:statusline .= '%P%* ' let l:statusline .= '%P%* '
"}}}
" non-empty buftype (help, quickfix, etc) " non-empty buftype (help, quickfix, etc)
if a:isactive "{{{ if a:isactive "{{{
@ -114,43 +114,43 @@ function! GetStatus(isactive) "{{{
" linter status " " linter status "
if a:isactive "{{{ if a:isactive "{{{
" errors " errors
let l:statusline .= " %#CRNoiseDark#%{(GetLinterStatus('error') == 0?'-':'')}" let l:statusline .= " %#LinterDashActive#%{(GetLinterStatus('error') == 0?'-':'')}"
let l:statusline .= "%#InterfaceSignError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}"
" style errors " style errors
let l:statusline .= '%#CRNoiseDarker#|' let l:statusline .= '%#LinterDash#|'
let l:statusline .= "%#CRNoiseDark#%{(GetLinterStatus('style_error') == 0?'-':'')}" let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_error') == 0?'-':'')}"
let l:statusline .= "%#InterfaceSignErrorDark#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} "
" warnings " warnings
let l:statusline .= "%#CRNoiseDark#%{(GetLinterStatus('warning') == 0?'-':'')}" let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('warning') == 0?'-':'')}"
let l:statusline .= "%#InterfaceSignWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}"
" style warnings " style warnings
let l:statusline .= '%#CRNoiseDarker#|' let l:statusline .= '%#LinterDash#|'
let l:statusline .= "%#CRNoiseDark#%{(GetLinterStatus('style_warning') == 0?'-':'')}" let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_warning') == 0?'-':'')}"
let l:statusline .= "%#InterfaceSignWarningDark#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} "
" info " info
let l:statusline .= "%#CRNoiseDark#%{(GetLinterStatus('info') == 0?'-':'')}" let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('info') == 0?'-':'')}"
let l:statusline .= "%#CRNoiseRed#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" let l:statusline .= "%#LinterInfo#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}"
else else
" errors " errors
let l:statusline .= " %#CRNoiseDarker#%{(GetLinterStatus('error') == 0?'-':'')}" let l:statusline .= " %#LinterDash#%{(GetLinterStatus('error') == 0?'-':'')}"
let l:statusline .= "%#CRNoiseBright#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" let l:statusline .= "%#LinterErrorInactive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}"
" style errors " style errors
let l:statusline .= '%#CRNoiseDarker#|' let l:statusline .= '%#LinterDash#|'
let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}" let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}"
let l:statusline .= "%#CRNoiseBright#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " let l:statusline .= "%#LinterErrorStyleInactive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} "
" warnings " warnings
let l:statusline .= "%#CRNoiseDarker#%{(GetLinterStatus('warning') == 0?'-':'')}" let l:statusline .= "%#LinterDash#%{(GetLinterStatus('warning') == 0?'-':'')}"
let l:statusline .= "%#CRNoise#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" let l:statusline .= "%#LinterWarningInactive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}"
" style warnings " style warnings
let l:statusline .= '%#CRNoiseDarker#|' let l:statusline .= '%#LinterDash#|'
let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}" let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}"
let l:statusline .= "%#CRNoise#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " let l:statusline .= "%#LinterWarningStyleInactive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} "
" info " info
let l:statusline .= "%#CRNoiseDarker#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" let l:statusline .= "%#LinterInfoInactive#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}"
endif endif
"}}} "}}}
@ -166,6 +166,16 @@ augroup status "{{{
" autocmd InsertChange * setlocal statusline=%!GetStatus(1) " autocmd InsertChange * setlocal statusline=%!GetStatus(1)
augroup END"}}} augroup END"}}}
function! GetLinterStatus(key) abort "{{{
return 3
let l:linter = ale#statusline#Count(bufnr(''))
return l:linter[a:key]
endfunction
"}}}
" old linter status function
function! LinterStatus() abort "{{{ function! LinterStatus() abort "{{{
let l:counts = ale#statusline#Count(bufnr('')) let l:counts = ale#statusline#Count(bufnr(''))