fixes issue #9 Lowercase 'a' acute accent via opt-e not working

REMOVE g:AutoPairsShortcuts
ADD g:AutoPairsShortcutJump
This commit is contained in:
jiangfriend@gmail.com 2012-03-20 13:13:39 +08:00
parent 8026a0db4b
commit 48232b5e3d
2 changed files with 30 additions and 23 deletions

View File

@ -84,14 +84,15 @@ Shortcuts
System Shortcuts: System Shortcuts:
<CR> : Insert new indented line after return if cursor in blank brackets or quotes. <CR> : Insert new indented line after return if cursor in blank brackets or quotes.
<BS> : Delete brackets in pair <BS> : Delete brackets in pair
<M-p> : Toggle Autopairs <M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle)
<M-e> : Fast Wrap <M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap)
<M-n> : Jump to next closed pair (g:AutoPairsShortcutJump)
Optional Shortcuts: If <M-p> <M-e> or <M-n> conflict with another keys or want to bind to another keys, add
could be turn off by let g:AutoPairsShortcuts = 0
<M-n> jump to next closed bracket. let g:AutoPairscutToggle = '<another key>'
<M-a> jump to end of line.
<M-o> jump to newline with indented. to .vimrc, it the key is empty string '', then the shortcut will be disabled.
Options Options
------- -------
@ -113,14 +114,11 @@ Options
(|)'hello' after fast wrap at |, the word will be ('hello') (|)'hello' after fast wrap at |, the word will be ('hello')
(|)<hello> after fast wrap at |, the word will be (<hello>) (|)<hello> after fast wrap at |, the word will be (<hello>)
* g:AutoPairsShortcuts * g:AutoPairsShortcutJump
Default: 1 Default: '<M-n>'
imap 3 shortcuts Jump to the next closed pair
<M-n> jump to next closed bracket.
<M-a> jump to end of line.
<M-o> jump to newline with indented.
* g:AutoPairsMapBS * g:AutoPairsMapBS

View File

@ -54,6 +54,10 @@ if !exists('g:AutoPairsShortcutFastWrap')
let g:AutoPairsShortcutFastWrap = '<M-e>' let g:AutoPairsShortcutFastWrap = '<M-e>'
end end
if !exists('g:AutoPairsShortcutJump')
let g:AutoPairsShortcutJump = '<M-n>'
endif
let g:AutoPairsClosedPairs = {} let g:AutoPairsClosedPairs = {}
@ -162,7 +166,7 @@ function! AutoPairsDelete()
endfunction endfunction
function! AutoPairsJump() function! AutoPairsJump()
call search('[{("\[\]'')}]','W') call search('["\]'')}]','W')
endfunction endfunction
" Fast wrap the word in brackets " Fast wrap the word in brackets
@ -266,16 +270,21 @@ function! AutoPairsInit()
execute 'inoremap <buffer> <silent> <expr> <SPACE> AutoPairsSpace()' execute 'inoremap <buffer> <silent> <expr> <SPACE> AutoPairsSpace()'
end end
execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutFastWrap.' <C-R>=AutoPairsFastWrap()<CR>' if g:AutoPairsShortcutFastWrap != ''
" use <expr> to ensure showing the status when toggle execute 'inoremap <buffer> <silent> '.g:AutoPairsShortcutFastWrap.' <C-R>=AutoPairsFastWrap()<CR>'
execute 'inoremap <buffer> <silent> <expr> '.g:AutoPairsShortcutToggle.' AutoPairsToggle()'
execute 'noremap <buffer> <silent> '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()<CR>'
" If the keys map conflict with your own settings, delete or change them
if g:AutoPairsShortcuts
execute 'inoremap <buffer> <silent> <M-n> <ESC>:call AutoPairsJump()<CR>a'
execute 'inoremap <buffer> <silent> <M-a> <END>'
execute 'inoremap <buffer> <silent> <M-o> <END><CR>'
end end
if g:AutoPairsShortcutToggle != ''
" use <expr> to ensure showing the status when toggle
execute 'inoremap <buffer> <silent> <expr> '.g:AutoPairsShortcutToggle.' AutoPairsToggle()'
execute 'noremap <buffer> <silent> '.g:AutoPairsShortcutToggle.' :call AutoPairsToggle()<CR>'
end
if g:AutoPairsShortcutJump != ''
execute 'inoremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' <ESC>:call AutoPairsJump()<CR>a'
execute 'noremap <buffer> <silent> ' . g:AutoPairsShortcutJump. ' :call AutoPairsJump()<CR>'
end
endfunction endfunction
function! AutoPairsForceInit() function! AutoPairsForceInit()