From 48232b5e3d5ee35d66e354156ad7858d05b14153 Mon Sep 17 00:00:00 2001 From: "jiangfriend@gmail.com" Date: Tue, 20 Mar 2012 13:13:39 +0800 Subject: [PATCH] fixes issue #9 Lowercase 'a' acute accent via opt-e not working REMOVE g:AutoPairsShortcuts ADD g:AutoPairsShortcutJump --- README.md | 24 +++++++++++------------- plugin/auto-pairs.vim | 29 +++++++++++++++++++---------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 144b5ed..d90a3d3 100644 --- a/README.md +++ b/README.md @@ -84,14 +84,15 @@ Shortcuts System Shortcuts: : Insert new indented line after return if cursor in blank brackets or quotes. : Delete brackets in pair - : Toggle Autopairs - : Fast Wrap + : Toggle Autopairs (g:AutoPairsShortcutToggle) + : Fast Wrap (g:AutoPairsShortcutFastWrap) + : Jump to next closed pair (g:AutoPairsShortcutJump) - Optional Shortcuts: - could be turn off by let g:AutoPairsShortcuts = 0 - jump to next closed bracket. - jump to end of line. - jump to newline with indented. + If or conflict with another keys or want to bind to another keys, add + + let g:AutoPairscutToggle = '' + + to .vimrc, it the key is empty string '', then the shortcut will be disabled. Options ------- @@ -113,14 +114,11 @@ Options (|)'hello' after fast wrap at |, the word will be ('hello') (|) after fast wrap at |, the word will be () -* g:AutoPairsShortcuts +* g:AutoPairsShortcutJump - Default: 1 + Default: '' - imap 3 shortcuts - jump to next closed bracket. - jump to end of line. - jump to newline with indented. + Jump to the next closed pair * g:AutoPairsMapBS diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index 95773e4..0beddfe 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -54,6 +54,10 @@ if !exists('g:AutoPairsShortcutFastWrap') let g:AutoPairsShortcutFastWrap = '' end +if !exists('g:AutoPairsShortcutJump') + let g:AutoPairsShortcutJump = '' +endif + let g:AutoPairsClosedPairs = {} @@ -162,7 +166,7 @@ function! AutoPairsDelete() endfunction function! AutoPairsJump() - call search('[{("\[\]'')}]','W') + call search('["\]'')}]','W') endfunction " Fast wrap the word in brackets @@ -266,16 +270,21 @@ function! AutoPairsInit() execute 'inoremap AutoPairsSpace()' end - execute 'inoremap '.g:AutoPairsShortcutFastWrap.' =AutoPairsFastWrap()' - " use to ensure showing the status when toggle - execute 'inoremap '.g:AutoPairsShortcutToggle.' AutoPairsToggle()' - execute 'noremap '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()' - " If the keys map conflict with your own settings, delete or change them - if g:AutoPairsShortcuts - execute 'inoremap :call AutoPairsJump()a' - execute 'inoremap ' - execute 'inoremap ' + if g:AutoPairsShortcutFastWrap != '' + execute 'inoremap '.g:AutoPairsShortcutFastWrap.' =AutoPairsFastWrap()' end + + if g:AutoPairsShortcutToggle != '' + " use to ensure showing the status when toggle + execute 'inoremap '.g:AutoPairsShortcutToggle.' AutoPairsToggle()' + execute 'noremap '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()' + end + + if g:AutoPairsShortcutJump != '' + execute 'inoremap ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()a' + execute 'noremap ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()' + end + endfunction function! AutoPairsForceInit()