deprecate airline_detect_whitespace
This commit is contained in:
parent
71c8156f00
commit
e65aefac00
@ -163,7 +163,7 @@ function! airline#extensions#load()
|
||||
call airline#extensions#bufferline#init(s:ext)
|
||||
endif
|
||||
|
||||
if g:airline_detect_whitespace
|
||||
if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1))
|
||||
call airline#extensions#whitespace#init()
|
||||
endif
|
||||
|
||||
|
@ -3,16 +3,23 @@
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
|
||||
" for backwards compatibility
|
||||
if exists('g:airline_detect_whitespace')
|
||||
let s:show_message = g:airline_detect_whitespace == 1
|
||||
else
|
||||
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
|
||||
endif
|
||||
|
||||
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol',
|
||||
\ get(g:, 'airline_whitespace_symbol', exists('g:airline_powerline_fonts') ? '✹' : '!'))
|
||||
|
||||
let s:checks = get(g:, 'airline#extensions#whitespace#checks', ['indent', 'trailing'])
|
||||
|
||||
let s:initialized = 0
|
||||
let s:vimrc_detect_whitespace = g:airline_detect_whitespace
|
||||
let s:enabled = 1
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
if &readonly || g:airline_detect_whitespace <= 0
|
||||
if &readonly || !s:enabled
|
||||
return ''
|
||||
endif
|
||||
|
||||
@ -32,7 +39,7 @@ function! airline#extensions#whitespace#check()
|
||||
|
||||
if trailing != 0 || mixed
|
||||
let b:airline_whitespace_check = s:symbol." "
|
||||
if g:airline_detect_whitespace == 1
|
||||
if s:show_message
|
||||
if trailing != 0
|
||||
let b:airline_whitespace_check .= 'trailing['.trailing.'] '
|
||||
endif
|
||||
@ -54,12 +61,12 @@ function! airline#extensions#whitespace#apply()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#toggle()
|
||||
if g:airline_detect_whitespace > 0
|
||||
if s:enabled
|
||||
autocmd! airline_whitespace CursorHold,BufWritePost
|
||||
let g:airline_detect_whitespace = 0
|
||||
let s:enabled = 0
|
||||
else
|
||||
call airline#extensions#whitespace#init()
|
||||
let g:airline_detect_whitespace = s:vimrc_detect_whitespace
|
||||
let s:enabled = 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -69,6 +76,7 @@ function! airline#extensions#whitespace#init()
|
||||
call add(g:airline_statusline_funcrefs, function('airline#extensions#whitespace#apply'))
|
||||
endif
|
||||
|
||||
unlet! b:airline_whitespace_check
|
||||
augroup airline_whitespace
|
||||
autocmd!
|
||||
autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check
|
||||
|
@ -52,11 +52,6 @@ values):
|
||||
* enable iminsert detection >
|
||||
let g:airline_detect_iminsert=1
|
||||
<
|
||||
* enable whitespace detection >
|
||||
let g:airline_detect_whitespace=0 "disabled
|
||||
let g:airline_detect_whitespace=1 "icon and message (default)
|
||||
let g:airline_detect_whitespace=2 "icon only
|
||||
<
|
||||
* determine whether inactive windows should have the left section collapsed to
|
||||
only the filename of that buffer. >
|
||||
let g:airline_inactive_collapse=1
|
||||
@ -218,6 +213,19 @@ vim-gitgutter <https://github.com/airblade/vim-gitgutter>
|
||||
* set hunk count symbols. >
|
||||
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
|
||||
<
|
||||
*airline-whitespace*
|
||||
* enable/disable detection of whitespace errors. >
|
||||
let g:airline#extensions#whitespace#enabled = 1
|
||||
<
|
||||
* customize the whitespace symbol. >
|
||||
let g:airline#extensions#whitespace#symbol = '!'
|
||||
<
|
||||
* configure which whitespace checks to enable. >
|
||||
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ]
|
||||
<
|
||||
* configure whether a message should be displayed. >
|
||||
let g:airline#extensions#whitespace#show_message = 1
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
FUNCREFS *airline-funcrefs*
|
||||
|
@ -19,7 +19,6 @@ call s:check_defined('g:airline_right_alt_sep', exists('g:airline_powerline_font
|
||||
call s:check_defined('g:airline_detect_iminsert', 0)
|
||||
call s:check_defined('g:airline_detect_modified', 1)
|
||||
call s:check_defined('g:airline_detect_paste', 1)
|
||||
call s:check_defined('g:airline_detect_whitespace', 1)
|
||||
call s:check_defined('g:airline_readonly_symbol', exists('g:airline_powerline_fonts')?'':'RO')
|
||||
call s:check_defined('g:airline_linecolumn_prefix', exists('g:airline_powerline_fonts')?' ':':')
|
||||
call s:check_defined('g:airline_paste_symbol', (exists('g:airline_powerline_fonts') ? ' ' : '').'PASTE')
|
||||
|
Loading…
Reference in New Issue
Block a user