fix whitespace indent setting changed incorrectly when toggling
This commit is contained in:
parent
52b4100a4f
commit
2ca403053c
@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||||
|
|
||||||
|
let s:initialized = 0
|
||||||
|
let s:vimrc_detect_whitespace = g:airline_detect_whitespace
|
||||||
|
|
||||||
function! airline#extensions#whitespace#check()
|
function! airline#extensions#whitespace#check()
|
||||||
if &readonly || !g:airline_detect_whitespace
|
if &readonly || g:airline_detect_whitespace <= 0
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -40,15 +43,15 @@ function! airline#extensions#whitespace#apply()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#whitespace#toggle()
|
function! airline#extensions#whitespace#toggle()
|
||||||
let g:airline_detect_whitespace = !g:airline_detect_whitespace
|
if g:airline_detect_whitespace > 0
|
||||||
if g:airline_detect_whitespace
|
|
||||||
call airline#extensions#whitespace#init()
|
|
||||||
else
|
|
||||||
autocmd! airline_whitespace CursorHold,BufWritePost
|
autocmd! airline_whitespace CursorHold,BufWritePost
|
||||||
|
let g:airline_detect_whitespace = 0
|
||||||
|
else
|
||||||
|
call airline#extensions#whitespace#init()
|
||||||
|
let g:airline_detect_whitespace = s:vimrc_detect_whitespace
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:initialized = 0
|
|
||||||
function! airline#extensions#whitespace#init()
|
function! airline#extensions#whitespace#init()
|
||||||
if !s:initialized
|
if !s:initialized
|
||||||
let s:initialized = 1
|
let s:initialized = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user