Add wild closed pair
This commit is contained in:
parent
adf9224a41
commit
4d5060c80c
22
README.md
22
README.md
@ -57,13 +57,6 @@ Features
|
|||||||
|
|
||||||
* Fast Wrap
|
* Fast Wrap
|
||||||
|
|
||||||
input: |'hello' (press (<M-e> at |)
|
|
||||||
output: ('hello')
|
|
||||||
|
|
||||||
wrap string, only support c style string
|
|
||||||
input: |'h\\el\'lo' (press (<M-e> at |)
|
|
||||||
output ('h\\ello\'')
|
|
||||||
|
|
||||||
input: |[foo, bar()] (press (<M-e> at |)
|
input: |[foo, bar()] (press (<M-e> at |)
|
||||||
output: ([foo, bar()])
|
output: ([foo, bar()])
|
||||||
|
|
||||||
@ -250,6 +243,13 @@ Options
|
|||||||
Map <M-(> <M-)> <M-[> <M-]> <M-{> <M-}> <M-"> <M-'> to
|
Map <M-(> <M-)> <M-[> <M-]> <M-{> <M-}> <M-"> <M-'> to
|
||||||
move character under the cursor to the pair.
|
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
|
Buffer Level Pairs Setting
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
@ -290,7 +290,13 @@ Multibyte Pairs
|
|||||||
The default pairs is {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
|
The default pairs is {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
|
||||||
You could also define multibyte pairs such as <!-- -->, <% %> and so on
|
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
|
* General usage
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Maintainer: JiangMiao <jiangfriend@gmail.com>
|
" Maintainer: JiangMiao <jiangfriend@gmail.com>
|
||||||
" Contributor: camthompson
|
" Contributor: camthompson
|
||||||
" Last Change: 2019-01-15
|
" Last Change: 2019-01-15
|
||||||
" Version: 1.3.4
|
" Version: 2.0.0
|
||||||
" Homepage: http://www.vim.org/scripts/script.php?script_id=3599
|
" Homepage: http://www.vim.org/scripts/script.php?script_id=3599
|
||||||
" Repository: https://github.com/jiangmiao/auto-pairs
|
" Repository: https://github.com/jiangmiao/auto-pairs
|
||||||
" License: MIT
|
" License: MIT
|
||||||
@ -185,8 +185,8 @@ func! AutoPairsInsert(key)
|
|||||||
|
|
||||||
" check close pairs
|
" check close pairs
|
||||||
for [open, close] in b:AutoPairsList
|
for [open, close] in b:AutoPairsList
|
||||||
if close[0] == a:key
|
if a:key == g:AutoPairsWildClosedPair || close[0] == a:key
|
||||||
let m = s:matchbegin(after, '\v\s*\V'.close)
|
let m = s:matchbegin(after, '\v\s*\zs\V'.close)
|
||||||
if len(m) > 0
|
if len(m) > 0
|
||||||
" skip close pair
|
" skip close pair
|
||||||
call search(m[1], 'We')
|
call search(m[1], 'We')
|
||||||
|
Loading…
Reference in New Issue
Block a user