From 553af93ba2f16c36e74c5dc1b6c9d434520cf712 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 6 Nov 2017 11:49:11 +1300 Subject: 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. --- vim/plugin/toggle_option_flag.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vim/plugin') 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 -- cgit v1.2.3