From 3c6135d75f42f7acc826be47b79c37c91e7dc517 Mon Sep 17 00:00:00 2001 From: Alexey Zhikhartsev Date: Wed, 15 Feb 2017 15:59:12 -0500 Subject: [PATCH] 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() --- autoload/airline/extensions/whitespace.vim | 6 ++++++ doc/airline.txt | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/autoload/airline/extensions/whitespace.vim b/autoload/airline/extensions/whitespace.vim index 4e989644..861fb280 100644 --- a/autoload/airline/extensions/whitespace.vim +++ b/autoload/airline/extensions/whitespace.vim @@ -139,6 +139,12 @@ function! airline#extensions#whitespace#toggle() echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') endfunction +function! airline#extensions#whitespace#disable() + if s:enabled + call airline#extensions#whitespace#toggle() + endif +endfunction + function! airline#extensions#whitespace#init(...) call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check') diff --git a/doc/airline.txt b/doc/airline.txt index 2e97af1b..11454e94 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -489,6 +489,10 @@ eclim * enable/disable detection of whitespace errors. > 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. > " must be all spaces or all tabs before the first non-whitespace character let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default)