aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-19 21:56:06 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-19 21:56:06 +1200
commit5b64b6f525a0aec76373216be299194fbf61f4ab (patch)
treef97d6eab14284aa5a0b56777edc2234d3bb78e10
parentMerge branch 'release/v0.4.0' (diff)
parentBump VERSION (diff)
downloadvim-toggle-flags-1.0.0.tar.gz (sig)
vim-toggle-flags-1.0.0.zip
Merge branch 'release/v1.0.0'v1.0.0
* release/v1.0.0: Bump VERSION Rename plugin and documentation files Backport to Vim 6.0, add version load guard Rename plugin and commands Correct a few comments Rename README.md
-rw-r--r--VERSION2
-rw-r--r--doc/toggle_flags.txt30
-rw-r--r--doc/toggle_option_flags.txt30
-rw-r--r--plugin/toggle_flags.vim (renamed from plugin/toggle_option_flags.vim)15
4 files changed, 38 insertions, 39 deletions
diff --git a/VERSION b/VERSION
index 1d0ba9e..3eefcb9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.4.0
+1.0.0
diff --git a/doc/toggle_flags.txt b/doc/toggle_flags.txt
new file mode 100644
index 0000000..81bf04d
--- /dev/null
+++ b/doc/toggle_flags.txt
@@ -0,0 +1,30 @@
+*toggle_flags.txt* For Vim version 6.0 Last change: 2018 July 19
+
+DESCRIPTION *toggle_flags*
+
+ *:ToggleFlag* *:ToggleFlagLocal*
+This plugin provides `:ToggleFlag` and `:ToggleFlagLocal` commands
+to toggle the values of options like |'formatoptions'| or |'complete'| that
+have values comprised of single-character or comma-separated flags. The author
+originally designed it for toggling flags in |'formatoptions'| quickly.
+
+EXAMPLES *toggle_flags-examples*
+>
+ :ToggleFlag formatoptions a
+ :ToggleFlag switchbuf useopen
+ :ToggleFlagLocal shortmess I
+<
+REQUIREMENTS *toggle_flags-requirements*
+
+This plugin is only available if 'compatible' is not set. It also requires the
+|+user_commands| Vim feature.
+
+AUTHOR *toggle_flags-author*
+
+Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
+
+LICENSE *toggle_flags-license*
+
+Licensed for distribution under the same terms as Vim itself (see |license|).
+
+ vim:tw=78:ts=8:ft=help:norl:
diff --git a/doc/toggle_option_flags.txt b/doc/toggle_option_flags.txt
deleted file mode 100644
index a635eb0..0000000
--- a/doc/toggle_option_flags.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-*toggle_option_flags.txt* For Vim version 6.0 Last change: 2018 June 17
-
-DESCRIPTION *toggle_option_flags*
-
- *:ToggleOptionFlag* *:ToggleOptionFlagLocal*
-This plugin provides `:ToggleOptionFlag` and `:ToggleOptionFlagLocal` commands
-to toggle the values of options like |'formatoptions'| or |'complete'| that
-have values comprised of single-character or comma-separated flags. The author
-originally designed it for toggling flags in |'formatoptions'| quickly.
-
-EXAMPLES *toggle_option_flags-examples*
->
- :ToggleOptionFlag formatoptions a
- :ToggleOptionFlag switchbuf useopen
- :ToggleOptionFlagLocal shortmess I
-<
-REQUIREMENTS *toggle_option_flags-requirements*
-
-This plugin is only available if 'compatible' is not set. It also requires the
-|+user_commands| Vim feature.
-
-AUTHOR *toggle_option_flags-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *toggle_option_flags-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
- vim:tw=78:ts=8:ft=help:norl:
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)