diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/toggle_flags.vim (renamed from plugin/toggle_option_flags.vim) | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugin/toggle_option_flags.vim b/plugin/toggle_flags.vim index fe3e83a..4157164 100644 --- a/plugin/toggle_option_flags.vim +++ b/plugin/toggle_flags.vim @@ -1,17 +1,17 @@ " -" toggle_option_flags.vim: Provide commands to toggle flags in grouped options +" toggle_flags.vim: Provide commands to toggle flags in grouped options " like 'formatoptions', 'shortmess', 'complete', 'switchbuf', etc. " " Author: Tom Ryder <tom@sanctum.geek.nz> " License: Same as Vim itself " -if exists('g:loaded_toggle_option_flags') || &compatible +if exists('g:loaded_toggle_flags') || &compatible finish endif if !has('user_commands') || v:version < 600 finish endif -let g:loaded_toggle_option_flags = 1 +let g:loaded_toggle_flags = 1 " Show an error-highlighted message and beep, but without a real :echoerr function! s:Error(message) @@ -25,7 +25,6 @@ endfunction function! s:Has(option, flag) " Horrible :execute to get the option's current setting into a variable - " (I couldn't get {curly braces} indirection to work) let l:current = '' execute 'let l:current = &' . a:option @@ -41,7 +40,7 @@ function! s:Has(option, flag) let l:search_value = l:current endif - " Return whether + " Return whether the flag appears in the value return stridx(l:search_value, l:search_flag) > -1 endfunction @@ -90,15 +89,15 @@ function! s:Toggle(option, flag, local) call s:Error('Unable to toggle '.a:option.' flag '.a:flag) endif - " Return value is whether we made a change + " Return whether we made a change return l:before != l:after endfunction " User commands wrapping around calls to the above function command -nargs=+ -complete=option - \ ToggleOptionFlag + \ ToggleFlag \ call <SID>Toggle(<f-args>, 0) command -nargs=+ -complete=option - \ ToggleOptionFlagLocal + \ ToggleFlagLocal \ call <SID>Toggle(<f-args>, 1) |