look up whitespace checks all the time. resolves #330.

This commit is contained in:
Bailey Ling 2013-11-03 14:03:36 -05:00
parent aef500c426
commit 31f36740c8
1 changed files with 4 additions and 3 deletions

View File

@ -11,7 +11,7 @@ else
endif
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
let s:checks = get(g:, 'airline#extensions#whitespace#checks', ['indent', 'trailing'])
let s:default_checks = ['indent', 'trailing']
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]')
let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]')
@ -25,14 +25,15 @@ function! airline#extensions#whitespace#check()
if !exists('b:airline_whitespace_check')
let b:airline_whitespace_check = ''
let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks)
let trailing = 0
if index(s:checks, 'trailing') > -1
if index(checks, 'trailing') > -1
let trailing = search(' $', 'nw')
endif
let mixed = 0
if index(s:checks, 'indent') > -1
if index(checks, 'indent') > -1
let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')]
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0
endif