Skip to content

Instantly share code, notes, and snippets.

@flavius
Forked from anonymous/gist:4306435
Created December 16, 2012 12:28
Show Gist options
  • Save flavius/4306769 to your computer and use it in GitHub Desktop.
Save flavius/4306769 to your computer and use it in GitHub Desktop.
function! ToggleFlagOptionValue(option, flag)
exe "set " . a:option . eval("&" . a:option . " =~# '" . a:flag . "' ? '-=" . a:flag . "' : '+=" . a:flag . "'")
endfunction
echo &go
call ToggleFlagOptionValue('go', 'T')
call ToggleFlagOptionValue('go', 'r')
echo &go
# for flag in ['T', 'r'] | call ToggleFlagOptionValue('go', flag) | endfor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment