2013-08-06 20:17:33 -04:00
|
|
|
" MIT license. Copyright (c) 2013 Bailey Ling.
|
|
|
|
" vim: ts=2 sts=2 sw=2 fdm=indent
|
|
|
|
|
|
|
|
function! airline#extensions#whitespace#check()
|
2013-08-06 20:48:53 -04:00
|
|
|
if line('$') > g:airline_whitespace_max_lines
|
|
|
|
return ''
|
|
|
|
endif
|
|
|
|
|
|
|
|
let trailing = search(' $', 'nw') != 0
|
|
|
|
let mixed = search('^ ', 'nw') != 0 && search('^\t', 'nw') != 0
|
|
|
|
|
|
|
|
if trailing || mixed
|
2013-08-06 21:42:32 -04:00
|
|
|
let text = g:airline_whitespace_symbol." "
|
2013-08-06 20:48:53 -04:00
|
|
|
if g:airline_detect_whitespace == 1
|
|
|
|
if trailing
|
|
|
|
let text .= 'trailing '
|
|
|
|
endif
|
|
|
|
if mixed
|
|
|
|
let text .= 'mixed-indent '
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
return text
|
|
|
|
endif
|
|
|
|
return ''
|
|
|
|
endfunction!
|
|
|
|
|
|
|
|
function! airline#extensions#whitespace#apply()
|
|
|
|
if exists('w:airline_active') && w:airline_active
|
|
|
|
let w:airline_section_warning = '%{airline#extensions#whitespace#check()}'
|
|
|
|
endif
|
2013-08-06 20:17:33 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! airline#extensions#whitespace#init(ext)
|
2013-08-06 20:48:53 -04:00
|
|
|
call a:ext.add_statusline_funcref(function('airline#extensions#whitespace#apply'))
|
2013-08-06 20:17:33 -04:00
|
|
|
endfunction
|
2013-08-06 20:48:53 -04:00
|
|
|
|