Fix jump over closed pair

This commit is contained in:
Miao Jiang 2019-01-15 18:45:46 +08:00
commit 1ff8be79d3
2 changed files with 14 additions and 8 deletions

View File

@ -5,11 +5,12 @@ Insert or delete brackets, parens, quotes in pair.
Installation
------------
copy plugin/auto-pairs.vim to ~/.vim/plugin
or if you are using `pathogen`:
```git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs```
* Manual
* Copy `plugin/auto-pairs.vim` to `~/.vim/plugin`
* [Pathogen](https://github.com/tpope/vim-pathogen)
* `git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs`
* [Vundle](https://github.com/VundleVim/Vundle.vim)
* `Plugin 'jiangmiao/auto-pairs'`
Features
--------

View File

@ -189,8 +189,13 @@ func! AutoPairsInsert(key)
let m = s:matchbegin(after, '\v\s*\zs\V'.close)
if len(m) > 0
" skip close pair
call search(m[1], 'We')
return "\<Right>"
let c = matchstr(after, '^\V'.close)
if c != ""
return s:right(c)
else
call search(m[1], 'We')
return "\<Right>"
end
end
end
endfor
@ -425,7 +430,7 @@ func! AutoPairsInit()
end
let c = close[0]
call AutoPairsMap(o)
if o != c && mapclose
if o != c && c != '' && mapclose
call AutoPairsMap(c)
end
let b:AutoPairsList += [[open, close]]