2019-03-25 07:27:10 -04:00
|
|
|
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
2013-08-20 11:02:17 -04:00
|
|
|
" vim: et ts=2 sts=2 sw=2
|
2013-08-05 22:56:30 -04:00
|
|
|
|
2016-09-23 20:16:30 -04:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
2013-09-10 11:37:25 -04:00
|
|
|
if !exists(':SyntasticCheck')
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2017-06-20 16:26:22 -04:00
|
|
|
let s:error_symbol = get(g:, 'airline#extensions#syntastic#error_symbol', 'E:')
|
|
|
|
let s:warning_symbol = get(g:, 'airline#extensions#syntastic#warning_symbol', 'W:')
|
|
|
|
|
|
|
|
function! airline#extensions#syntastic#get_warning()
|
|
|
|
return airline#extensions#syntastic#get('warning')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#extensions#syntastic#get_error()
|
|
|
|
return airline#extensions#syntastic#get('error')
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#extensions#syntastic#get(type)
|
|
|
|
let _backup = get(g:, 'syntastic_stl_format', '')
|
|
|
|
let is_err = (a:type is# 'error')
|
|
|
|
if is_err
|
2019-02-21 18:53:41 -05:00
|
|
|
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%fe(#%e)]}')
|
2017-06-20 16:26:22 -04:00
|
|
|
else
|
2019-02-21 18:53:41 -05:00
|
|
|
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%fw(#%w)]}')
|
2017-06-20 16:26:22 -04:00
|
|
|
endif
|
|
|
|
let cnt = SyntasticStatuslineFlag()
|
|
|
|
if !empty(_backup)
|
|
|
|
let g:syntastic_stl_format = _backup
|
|
|
|
endif
|
2017-08-08 08:57:04 -04:00
|
|
|
if empty(cnt)
|
2017-06-20 16:26:22 -04:00
|
|
|
return ''
|
|
|
|
else
|
|
|
|
return (is_err ? s:error_symbol : s:warning_symbol).cnt
|
2013-08-27 19:38:34 -04:00
|
|
|
endif
|
2013-08-05 22:56:30 -04:00
|
|
|
endfunction
|
2013-08-06 21:42:32 -04:00
|
|
|
|
|
|
|
function! airline#extensions#syntastic#init(ext)
|
2017-06-20 16:26:22 -04:00
|
|
|
call airline#parts#define_function('syntastic-warn', 'airline#extensions#syntastic#get_warning')
|
|
|
|
call airline#parts#define_function('syntastic-err', 'airline#extensions#syntastic#get_error')
|
2013-08-06 21:42:32 -04:00
|
|
|
endfunction
|