Created
January 31, 2019 21:54
-
-
Save thomasba/20150afa17dfdebc046fed61ace6c5af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Map keys to toggle functions | |
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>) | |
MapToggle <F7> hlsearch | |
MapToggle <F4> number | |
MapToggle <F5> spell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment