Skip to content

Instantly share code, notes, and snippets.

Created December 16, 2012 11:21
Show Gist options
  • Save anonymous/4306435 to your computer and use it in GitHub Desktop.
Save anonymous/4306435 to your computer and use it in GitHub Desktop.
ToggleFlagOptionValue
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment