whitespace: Allow to disable individual whitespace checks per filetype
closes #1716
This commit is contained in:
parent
c4a4a20b8d
commit
33310c5b24
@ -10,7 +10,7 @@ let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols
|
|||||||
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
|
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
|
||||||
|
|
||||||
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
|
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file']}
|
||||||
|
|
||||||
function! s:check_mixed_indent()
|
function! s:check_mixed_indent()
|
||||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||||
@ -53,6 +53,8 @@ function! airline#extensions#whitespace#check()
|
|||||||
\ || get(b:, 'airline_whitespace_disabled', 0)
|
\ || get(b:, 'airline_whitespace_disabled', 0)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
let skip_check_ft = extend(s:skip_check_ft,
|
||||||
|
\ get(g:, 'airline#extensions#whitespace#skip_indent_check_ft', {}), 'force')
|
||||||
|
|
||||||
if !exists('b:airline_whitespace_check')
|
if !exists('b:airline_whitespace_check')
|
||||||
let b:airline_whitespace_check = ''
|
let b:airline_whitespace_check = ''
|
||||||
@ -72,13 +74,13 @@ function! airline#extensions#whitespace#check()
|
|||||||
|
|
||||||
let mixed = 0
|
let mixed = 0
|
||||||
let check = 'indent'
|
let check = 'indent'
|
||||||
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
|
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
|
||||||
let mixed = s:check_mixed_indent()
|
let mixed = s:check_mixed_indent()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let mixed_file = ''
|
let mixed_file = ''
|
||||||
let check = 'mixed-indent-file'
|
let check = 'mixed-indent-file'
|
||||||
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
|
if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0
|
||||||
let mixed_file = s:check_mixed_indent_file()
|
let mixed_file = s:check_mixed_indent_file()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -670,6 +670,14 @@ eclim <https://eclim.org>
|
|||||||
" then whitespace checking will be disabled for that buffer; for example:
|
" then whitespace checking will be disabled for that buffer; for example:
|
||||||
" let b:airline_whitespace_disabled = 1
|
" let b:airline_whitespace_disabled = 1
|
||||||
<
|
<
|
||||||
|
* disable specific whitespace checks for individual filetypes >
|
||||||
|
" The global variable g:airline#extensions#whitespace#skip_indent_check_ft
|
||||||
|
" defines what whitespaces checks to skip per filetype.
|
||||||
|
" the list can contain any of the available checks,
|
||||||
|
" (see above at g:airline#extensions#whitespace#checks)
|
||||||
|
" To disable mixed-indent-file for go files use:
|
||||||
|
let g:airline#extensions#whitespace#skip_indent_check_ft = {'go': ['mixed-indent-file']}
|
||||||
|
<
|
||||||
------------------------------------- *airline-tabline*
|
------------------------------------- *airline-tabline*
|
||||||
Note: If you're using the ctrlspace tabline only the option marked with (c)
|
Note: If you're using the ctrlspace tabline only the option marked with (c)
|
||||||
are supported!
|
are supported!
|
||||||
|
Loading…
Reference in New Issue
Block a user