mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 13:14:35 +08:00
Allow using commas and colons in matchpairs. Fix #208.
This commit is contained in:
@@ -48,7 +48,7 @@ function! s:init() "{{{
|
|||||||
call s:option_init("autoclose", 1)
|
call s:option_init("autoclose", 1)
|
||||||
" matchpairs
|
" matchpairs
|
||||||
call s:option_init("matchpairs", string(&matchpairs)[1:-2])
|
call s:option_init("matchpairs", string(&matchpairs)[1:-2])
|
||||||
call s:option_init("matchpairs_list", map(split(s:get('matchpairs'), ','), 'split(v:val, '':'')'))
|
call s:option_init("matchpairs_list", map(split(s:get('matchpairs'), '.:.\zs,\ze.:.'), 'split(v:val, ''^.\zs:\ze.$'')'))
|
||||||
let pairs = s:get('matchpairs_list')
|
let pairs = s:get('matchpairs_list')
|
||||||
if len(filter(pairs, 'v:val[0] ==# v:val[1]'))
|
if len(filter(pairs, 'v:val[0] ==# v:val[1]'))
|
||||||
echohl ErrorMsg
|
echohl ErrorMsg
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
let g:delimitMate_matchpairs = '(:),{:},[:],<:>,¿:?,¡:!'
|
let g:delimitMate_matchpairs = '(:),{:},[:],<:>,¿:?,¡:!,,::'
|
||||||
let lines = readfile(expand('<sfile>:t:r').'.txt')
|
let lines = readfile(expand('<sfile>:t:r').'.txt')
|
||||||
call vimtest#StartTap()
|
call vimtest#StartTap()
|
||||||
let testsnumber = len(filter(copy(lines), 'v:val =~ ''^"'''))
|
let testsnumber = len(filter(copy(lines), 'v:val =~ ''^"'''))
|
||||||
let itemsnumber = len(split(g:delimitMate_matchpairs, ','))
|
let itemsnumber = len(split(g:delimitMate_matchpairs, '.:.\zs,\ze.:.'))
|
||||||
call vimtap#Plan(testsnumber * itemsnumber)
|
call vimtap#Plan(testsnumber * itemsnumber)
|
||||||
let tcount = 1
|
let tcount = 1
|
||||||
let reload = 1
|
let reload = 1
|
||||||
@@ -24,7 +24,7 @@ for item in lines
|
|||||||
let reload = 0
|
let reload = 0
|
||||||
endif
|
endif
|
||||||
let [input, output] = split(item, '"\%(\\.\|[^\\"]\)*"\zs\s*\ze"\%(\\.\|[^\\"]\)*"')
|
let [input, output] = split(item, '"\%(\\.\|[^\\"]\)*"\zs\s*\ze"\%(\\.\|[^\\"]\)*"')
|
||||||
for [s:l,s:r] in map(split(g:delimitMate_matchpairs, ','), 'split(v:val, ":")')
|
for [s:l,s:r] in map(split(g:delimitMate_matchpairs, '.:.\zs,\ze.:.'), 'split(v:val, ''.\zs:\ze.'')')
|
||||||
let input2 = substitute(input, '(', s:l, 'g')
|
let input2 = substitute(input, '(', s:l, 'g')
|
||||||
let input2 = substitute(input2, ')', s:r, 'g')
|
let input2 = substitute(input2, ')', s:r, 'g')
|
||||||
let output2 = substitute(output, '(', s:l, 'g')
|
let output2 = substitute(output, '(', s:l, 'g')
|
||||||
|
|||||||
Reference in New Issue
Block a user