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