2020-06-11 04:18:30 +08:00
|
|
|
" MIT License. Copyright (c) 2013-2020 Bailey Ling et al.
|
2019-11-09 03:18:04 +08:00
|
|
|
" Plugin: https://github.com/vim-syntastic/syntastic
|
2013-08-20 23:02:17 +08:00
|
|
|
" vim: et ts=2 sts=2 sw=2
|
2013-08-06 10:56:30 +08:00
|
|
|
|
2016-09-24 08:16:30 +08:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
2013-09-10 23:37:25 +08:00
|
|
|
if !exists(':SyntasticCheck')
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2017-06-21 04:26:22 +08: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-22 07:53:41 +08:00
|
|
|
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%fe(#%e)]}')
|
2017-06-21 04:26:22 +08:00
|
|
|
else
|
2019-02-22 07:53:41 +08:00
|
|
|
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%fw(#%w)]}')
|
2017-06-21 04:26:22 +08:00
|
|
|
endif
|
|
|
|
let cnt = SyntasticStatuslineFlag()
|
|
|
|
if !empty(_backup)
|
|
|
|
let g:syntastic_stl_format = _backup
|
|
|
|
endif
|
2017-08-08 20:57:04 +08:00
|
|
|
if empty(cnt)
|
2017-06-21 04:26:22 +08:00
|
|
|
return ''
|
|
|
|
else
|
|
|
|
return (is_err ? s:error_symbol : s:warning_symbol).cnt
|
2013-08-28 07:38:34 +08:00
|
|
|
endif
|
2013-08-06 10:56:30 +08:00
|
|
|
endfunction
|
2013-08-07 09:42:32 +08:00
|
|
|
|
|
|
|
function! airline#extensions#syntastic#init(ext)
|
2017-06-21 04:26:22 +08: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-07 09:42:32 +08:00
|
|
|
endfunction
|