diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-06 11:49:11 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-06 11:49:11 +1300 |
commit | 553af93ba2f16c36e74c5dc1b6c9d434520cf712 (patch) | |
tree | beaf0458ea90398f4939896377e979099ab058cc /vim/plugin | |
parent | Use idiomatic VimL regex for param validation (diff) | |
download | dotfiles-553af93ba2f16c36e74c5dc1b6c9d434520cf712.tar.gz dotfiles-553af93ba2f16c36e74c5dc1b6c9d434520cf712.zip |
Separate command building from execution in toggle
These are functionally equivalent; it's just clearer and more
editing-friendly to do one thing at a time.
Diffstat (limited to 'vim/plugin')
-rw-r--r-- | vim/plugin/toggle_option_flag.vim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vim/plugin/toggle_option_flag.vim b/vim/plugin/toggle_option_flag.vim index c3ea01a0..5376a279 100644 --- a/vim/plugin/toggle_option_flag.vim +++ b/vim/plugin/toggle_option_flag.vim @@ -39,9 +39,13 @@ function! s:Toggle(option, flag, local) let l:op = '' execute 'let l:op = &' . a:option . ' =~# a:flag ? "-=" : "+="' - " :execute to perform the option toggle and then print the value - execute l:set . ' ' . a:option . l:op . a:flag - execute l:set . ' ' . a:option . '?' + " Build the command strings to set and then show the value + let l:cmd_set = l:set . ' ' . a:option . l:op . a:flag + let l:cmd_show = l:set . ' ' . a:option . '?' + + " Run the set and show command strings + execute l:cmd_set + execute l:cmd_show endfunction |