Add a function to disable whitespace-detection

Useful to call for particular file types (e.g., .tex files):
ftplugin/tex.vim:
    call airline#extensions#whitespace#disable()
This commit is contained in:
Alexey Zhikhartsev 2017-02-15 15:59:12 -05:00 committed by Christian Brabandt
parent 7e6986651c
commit 3c6135d75f
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 10 additions and 0 deletions

View File

@ -139,6 +139,12 @@ function! airline#extensions#whitespace#toggle()
echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')
endfunction endfunction
function! airline#extensions#whitespace#disable()
if s:enabled
call airline#extensions#whitespace#toggle()
endif
endfunction
function! airline#extensions#whitespace#init(...) function! airline#extensions#whitespace#init(...)
call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check') call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check')

View File

@ -489,6 +489,10 @@ eclim <https://eclim.org>
* enable/disable detection of whitespace errors. > * enable/disable detection of whitespace errors. >
let g:airline#extensions#whitespace#enabled = 1 let g:airline#extensions#whitespace#enabled = 1
< <
* disable detection of whitespace errors. >
" useful to call for particular file types (e.g., in "ftplugin/*")
silent! call airline#extensions#whitespace#disable
<
* customize the type of mixed indent checking to perform. > * customize the type of mixed indent checking to perform. >
" must be all spaces or all tabs before the first non-whitespace character " must be all spaces or all tabs before the first non-whitespace character
let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default) let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default)