file percentage coloring
This commit is contained in:
parent
8bea08b877
commit
9413680f65
|
@ -1,8 +1,6 @@
|
||||||
" #statusline format
|
" #statusline format
|
||||||
" isactive = 0 when inactive, 1 otherwise
|
|
||||||
|
|
||||||
" get status line
|
function! GetStatus(isactive) "{{{
|
||||||
function! GetStatus(isactive)
|
|
||||||
" let l:linter = ale#statusline#Count(bufnr(''))
|
" let l:linter = ale#statusline#Count(bufnr(''))
|
||||||
let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >'
|
let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >'
|
||||||
let l:separator = '%#StatusLineSeparator# '
|
let l:separator = '%#StatusLineSeparator# '
|
||||||
|
@ -11,26 +9,28 @@ function! GetStatus(isactive)
|
||||||
let l:bracket_open = '%#CRNoiseDark#('
|
let l:bracket_open = '%#CRNoiseDark#('
|
||||||
let l:bracket_close = '%#CRNoiseDark#) '
|
let l:bracket_close = '%#CRNoiseDark#) '
|
||||||
let l:statusline = ''
|
let l:statusline = ''
|
||||||
" let l:statusline = '%#CRNoise#b%#CRNoiseDark#:%#CRNoiseBright#%n '
|
|
||||||
|
|
||||||
" let l:curbuf = bufnr('')
|
|
||||||
" let l:statusline .= '%#CRNormal#' . l:curbuf . ': ' . &buftype . ' '
|
|
||||||
|
|
||||||
" file percentage
|
" file percentage
|
||||||
let l:statusline.='%#FoldColumn#: %#InterfaceNormal# %P%* '
|
let l:statusline .= '%#FoldColumn#: '
|
||||||
|
|
||||||
|
|
||||||
if a:isactive
|
if a:isactive
|
||||||
|
let l:statusline .= '%#StatusLineNormal#'
|
||||||
|
else
|
||||||
|
let l:statusline .= '%#StatusLineDir#'
|
||||||
|
endif
|
||||||
|
let l:statusline .= '%P%* '
|
||||||
|
|
||||||
|
|
||||||
|
" non-empty buftype (help, quickfix, etc)
|
||||||
|
if a:isactive "{{{
|
||||||
let l:statusline .= l:active . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineActiveNoText#"
|
let l:statusline .= l:active . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineActiveNoText#"
|
||||||
else
|
else
|
||||||
let l:statusline .= l:normal . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineNormalNoText#"
|
let l:statusline .= l:normal . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineNormalNoText#"
|
||||||
endif
|
endif
|
||||||
let l:statusline .= "%{&buftype == '' ? '' : ' '}%s"
|
let l:statusline .= "%{&buftype == '' ? '' : ' '}%s"
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
|
||||||
" file info
|
" file info
|
||||||
if a:isactive == 1
|
if a:isactive == 1 "{{{
|
||||||
let l:statusline.=l:active
|
let l:statusline.=l:active
|
||||||
let l:statusline.=" %{strlen(&ft)?&ft:'none'} "
|
let l:statusline.=" %{strlen(&ft)?&ft:'none'} "
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
|
@ -42,26 +42,25 @@ function! GetStatus(isactive)
|
||||||
else
|
else
|
||||||
let l:statusline.=l:separator
|
let l:statusline.=l:separator
|
||||||
endif
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
" current register
|
" current register
|
||||||
if a:isactive
|
if a:isactive "{{{
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
let l:statusline.=' %#StatusLineActiveQuotes#"' . l:active . '%{v:register}%#StatusLineActiveQuotes#" '
|
let l:statusline.=' %#StatusLineActiveQuotes#"' . l:active . '%{v:register}%#StatusLineActiveQuotes#" '
|
||||||
endif
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
" session status
|
" session status
|
||||||
if a:isactive
|
if a:isactive "{{{
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
let l:statusline.=" %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} %*"
|
let l:statusline.=" %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} %*"
|
||||||
let l:statusline.=l:separator . l:active
|
let l:statusline.=l:separator . l:active
|
||||||
endif
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
" right/left divider
|
" right/left divider
|
||||||
|
" modified version {{{
|
||||||
" modified version
|
|
||||||
let l:color = 'StatusLineDivMod' . (a:isactive?'Active':'')
|
let l:color = 'StatusLineDivMod' . (a:isactive?'Active':'')
|
||||||
let l:statusline .= GetStatusFrag("&modified && mode() != 'i'", l:color, '%<', l:divider)
|
let l:statusline .= GetStatusFrag("&modified && mode() != 'i'", l:color, '%<', l:divider)
|
||||||
|
|
||||||
|
@ -75,49 +74,39 @@ function! GetStatus(isactive)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:statusline.= l:separator . '%*%='
|
let l:statusline.= l:separator . '%*%='
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" path/filename.extension
|
||||||
|
if a:isactive "{{{
|
||||||
|
let l:statusline.='%#StatusLineDirActive# '
|
||||||
|
let l:statusline.="%{expand('%:p:h:t')}/"
|
||||||
|
let l:statusline.='%#StatusLineFileActive#'
|
||||||
|
|
||||||
|
let l:statusline.="%{expand('%:t:r')}"
|
||||||
|
|
||||||
" modified flag
|
let l:statusline.='%#StatusLineDotActive#'
|
||||||
" let l:statusline.='%#StatusLineMod#%M' . l:separator . '%*'
|
let l:statusline.="%{strlen(expand('%:e'))?'.':''}"
|
||||||
|
let l:statusline.='%#StatusLineExtActive#'
|
||||||
|
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
||||||
|
let l:statusline.=' %*'
|
||||||
|
else
|
||||||
|
let l:statusline.='%#StatusLineDir# '
|
||||||
|
let l:statusline.="%{expand('%:p:h')}/"
|
||||||
|
let l:statusline.='%#StatusLineFile#'
|
||||||
|
|
||||||
|
let l:statusline.="%{expand('%:t:r')}"
|
||||||
|
|
||||||
" path/filename.extension
|
let l:statusline.='%#StatusLineDot#'
|
||||||
|
let l:statusline.="%{strlen(expand('%:e'))?'.':''}"
|
||||||
|
let l:statusline.='%#StatusLineExt#'
|
||||||
if a:isactive
|
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
||||||
let l:statusline.='%#StatusLineDirActive# '
|
let l:statusline.=' %*'
|
||||||
let l:statusline.="%{expand('%:p:h:t')}/"
|
endif
|
||||||
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')}"
|
|
||||||
let l:statusline.=' %*'
|
|
||||||
else
|
|
||||||
let l:statusline.='%#StatusLineDir# '
|
|
||||||
let l:statusline.="%{expand('%:p:h')}/"
|
|
||||||
let l:statusline.='%#StatusLineFile#'
|
|
||||||
|
|
||||||
let l:statusline.="%{expand('%:t:r')}"
|
|
||||||
|
|
||||||
let l:statusline.='%#StatusLineDot#'
|
|
||||||
let l:statusline.="%{strlen(expand('%:e'))?'.':''}"
|
|
||||||
let l:statusline.='%#StatusLineExt#'
|
|
||||||
let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')}"
|
|
||||||
let l:statusline.=' %*'
|
|
||||||
endif
|
|
||||||
let l:statusline .= '%#CRNormal#%r' " TODO color
|
let l:statusline .= '%#CRNormal#%r' " TODO color
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
|
||||||
" linter status "
|
" linter status "
|
||||||
" let l:statusline.= "%{LinterStatus()} "
|
if a:isactive "{{{
|
||||||
|
|
||||||
if a:isactive
|
|
||||||
" errors
|
" errors
|
||||||
let l:statusline .= " %#CRNoiseDark#%{(GetLinterStatus('error') == 0?'-':'')}"
|
let l:statusline .= " %#CRNoiseDark#%{(GetLinterStatus('error') == 0?'-':'')}"
|
||||||
let l:statusline .= "%#InterfaceSignError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}"
|
let l:statusline .= "%#InterfaceSignError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}"
|
||||||
|
@ -157,23 +146,19 @@ endif
|
||||||
" info
|
" info
|
||||||
let l:statusline .= "%#CRNoiseDarker#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}"
|
let l:statusline .= "%#CRNoiseDarker#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}"
|
||||||
endif
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
|
||||||
return l:statusline
|
return l:statusline
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
" status line autocommands
|
augroup status "{{{
|
||||||
augroup status
|
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd WinEnter * setlocal statusline=%!GetStatus(1)
|
autocmd WinEnter * setlocal statusline=%!GetStatus(1)
|
||||||
autocmd WinLeave * setlocal statusline=%!GetStatus(0)
|
autocmd WinLeave * setlocal statusline=%!GetStatus(0)
|
||||||
" autocmd WinNew * setlocal statusline=%!GetStatus(1)
|
" autocmd WinNew * setlocal statusline=%!GetStatus(1)
|
||||||
" autocmd InsertChange * setlocal statusline=%!GetStatus(1)
|
" autocmd InsertChange * setlocal statusline=%!GetStatus(1)
|
||||||
augroup END
|
augroup END"}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function! LinterStatus() abort "{{{
|
function! LinterStatus() abort "{{{
|
||||||
let l:counts = ale#statusline#Count(bufnr(''))
|
let l:counts = ale#statusline#Count(bufnr(''))
|
||||||
|
|
Loading…
Reference in New Issue