vimrc/sources_non_forked/lightline-ale/autoload/lightline/ale.vim

58 lines
1.8 KiB
VimL
Raw Normal View History

2020-01-29 02:07:36 +00:00
let s:indicator_infos = get(g:, 'lightline#ale#indicator_infos', 'I: ')
2018-06-14 10:31:12 +00:00
let s:indicator_warnings = get(g:, 'lightline#ale#indicator_warnings', 'W: ')
let s:indicator_errors = get(g:, 'lightline#ale#indicator_errors', 'E: ')
let s:indicator_ok = get(g:, 'lightline#ale#indicator_ok', 'OK')
let s:indicator_checking = get(g:, 'lightline#ale#indicator_checking', 'Linting...')
""""""""""""""""""""""
" Lightline components
2020-01-29 02:07:36 +00:00
function! lightline#ale#infos() abort
if !lightline#ale#linted()
return ''
endif
let l:counts = ale#statusline#Count(bufnr(''))
return l:counts.info == 0 ? '' : printf(s:indicator_infos . '%d', l:counts.info)
endfunction
2018-06-14 10:31:12 +00:00
function! lightline#ale#warnings() abort
if !lightline#ale#linted()
return ''
endif
let l:counts = ale#statusline#Count(bufnr(''))
2020-01-29 02:07:36 +00:00
let l:all_warnings = l:counts.warning + l:counts.style_warning
return l:all_warnings == 0 ? '' : printf(s:indicator_warnings . '%d', all_warnings)
2018-06-14 10:31:12 +00:00
endfunction
function! lightline#ale#errors() abort
if !lightline#ale#linted()
return ''
endif
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
return l:all_errors == 0 ? '' : printf(s:indicator_errors . '%d', all_errors)
endfunction
function! lightline#ale#ok() abort
if !lightline#ale#linted()
return ''
endif
let l:counts = ale#statusline#Count(bufnr(''))
return l:counts.total == 0 ? s:indicator_ok : ''
endfunction
function! lightline#ale#checking() abort
return ale#engine#IsCheckingBuffer(bufnr('')) ? s:indicator_checking : ''
endfunction
""""""""""""""""""
" Helper functions
function! lightline#ale#linted() abort
return get(g:, 'ale_enabled', 0) == 1
\ && getbufvar(bufnr(''), 'ale_linted', 0) > 0
\ && ale#engine#IsCheckingBuffer(bufnr('')) == 0
endfunction