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