From 31f36740c81869e028fa7b665e0bfddc4e0ec3d2 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sun, 3 Nov 2013 14:03:36 -0500 Subject: [PATCH] look up whitespace checks all the time. resolves #330. --- autoload/airline/extensions/whitespace.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index 99dfd76..c8910af 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -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