From 931367d9fb0fc79a79286f98b56a8286b0a462a5 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sun, 20 Apr 2014 00:39:43 +0200 Subject: [PATCH] Enable :AirlineToggleWhitespace, even if g:airline#extensions#whitespace#enabled is disabled --- autoload/airline/extensions/whitespace.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index 60fd3d3..10d1406 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -19,7 +19,7 @@ let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0 let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) -let s:enabled = 1 +let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) function! s:check_mixed_indent() if s:indent_algo == 0 @@ -80,6 +80,14 @@ function! airline#extensions#whitespace#toggle() call airline#extensions#whitespace#init() let s:enabled = 1 endif + if exists("g:airline#extensions#whitespace#enabled") + let g:airline#extensions#whitespace#enabled = s:enabled + if s:enabled + let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace']) + call airline#update_statusline() + call airline#extensions#whitespace#init() + endif + endif echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') endfunction