Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
Created October 10, 2010 04:57
Show Gist options
  • Select an option

  • Save pbrisbin/618970 to your computer and use it in GitHub Desktop.

Select an option

Save pbrisbin/618970 to your computer and use it in GitHub Desktop.
function! MapToggle(key, opt)
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
exec 'nnoremap '.a:key.' '.cmd
exec 'inoremap '.a:key." \<C-O>".cmd
endfunction
command! -nargs=+ MapToggle call MapToggle(<f-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment