Skip to content

Instantly share code, notes, and snippets.

@iorionda
Created December 6, 2011 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iorionda/1436603 to your computer and use it in GitHub Desktop.
Save iorionda/1436603 to your computer and use it in GitHub Desktop.
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