Created
December 6, 2011 03:39
-
-
Save iorionda/1436603 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
function! ClosePairOn() | |
let b:closepair = 0 | |
inoremap [ []<Left> | |
inoremap { {}<Left> | |
inoremap ( ()<Left> | |
inoremap " ""<Left> | |
inoremap ' ''<Left> | |
inoremap ` ``<Left> | |
endfunction | |
function! ClosePairOff() | |
iunmap [ | |
iunmap { | |
iunmap ( | |
iunmap " | |
iunmap ' | |
iunmap ` | |
endfunction | |
function! ToggleClosePair() | |
if !exists("g:closepair_status") | |
let g:closepair_status = 1 | |
endif | |
if (g:closepair_status) | |
let g:closepair_status = 0 | |
echo "Current: Closing Pair On" | |
call ClosePairOn() | |
else | |
let g:closepair_status = 1 | |
echo "Current: Closing Pair Off" | |
call ClosePairOff() | |
endif | |
endfunction | |
nnoremap { :call ToggleClosePair()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment