diff --git a/README.md b/README.md index fda583f..667e9ed 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,6 @@ Features * Fast Wrap - input: |'hello' (press ( at |) - output: ('hello') - - wrap string, only support c style string - input: |'h\\el\'lo' (press ( at |) - output ('h\\ello\'') - input: |[foo, bar()] (press ( at |) output: ([foo, bar()]) @@ -250,6 +243,13 @@ Options Map to move character under the cursor to the pair. +* g:AutoPairsWildClosedPair + + Default: ']' + + Jump over following closed pair + for pair {'begin': 'end//n]'}, e is not mapped, use wild closed pair ] to jump over 'end' + Buffer Level Pairs Setting -------------------------- @@ -290,7 +290,13 @@ Multibyte Pairs The default pairs is {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'} You could also define multibyte pairs such as , <% %> and so on - Here are some examples +* Function AutoPairsDefine(addPairs:dict[, removeOpenPairList:list]) + + add or delete pairs base on g:AutoPairs + + eg: + au FileType html let b:AutoPairs = AutoPairsDefine({''}, ['{']) + add pair and remove '{' for html file * General usage diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index 2cb6340..ae79b32 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -2,7 +2,7 @@ " Maintainer: JiangMiao " Contributor: camthompson " Last Change: 2019-01-15 -" Version: 1.3.4 +" Version: 2.0.0 " Homepage: http://www.vim.org/scripts/script.php?script_id=3599 " Repository: https://github.com/jiangmiao/auto-pairs " License: MIT @@ -185,8 +185,8 @@ func! AutoPairsInsert(key) " check close pairs for [open, close] in b:AutoPairsList - if close[0] == a:key - let m = s:matchbegin(after, '\v\s*\V'.close) + if a:key == g:AutoPairsWildClosedPair || close[0] == a:key + let m = s:matchbegin(after, '\v\s*\zs\V'.close) if len(m) > 0 " skip close pair call search(m[1], 'We')