diff --git a/plugin/better-whitespace.vim b/plugin/better-whitespace.vim index a061981..36983b2 100644 --- a/plugin/better-whitespace.vim +++ b/plugin/better-whitespace.vim @@ -104,21 +104,16 @@ endfunction " Enable the whitespace highlighting function! s:EnableWhitespace() - if b:better_whitespace_enabled != 1 - let b:better_whitespace_enabled = 1 - call WhitespaceInit() - call SetupAutoCommands() - call Echo("Whitespace Highlighting: Enabled") - endif + let b:better_whitespace_enabled = 1 + call Echo("Whitespace Highlighting: Enabled") + call SetupAutoCommands() endfunction " Disable the whitespace highlighting function! s:DisableWhitespace() - if b:better_whitespace_enabled != 0 - let b:better_whitespace_enabled = 0 - call SetupAutoCommands() - call Echo("Whitespace Highlighting: Disabled") - endif + let b:better_whitespace_enabled = 0 + call Echo("Whitespace Highlighting: Disabled") + call SetupAutoCommands() endfunction " Toggle whitespace highlighting on/off @@ -277,7 +272,7 @@ endfunction function! s:ShouldStripWhitespace() call s:InitVariable('b:strip_whitespace_on_save', -1) if b:strip_whitespace_on_save < 0 - if b:better_whitespace_enabled < 0 + if !exists('b:better_whitespace_enabled') || b:better_whitespace_enabled < 0 " We can't initialize buffer value properly yet, fall back to global one return g:strip_whitespace_on_save else