Allow using commas and colons in matchpairs. Fix #208.

This commit is contained in:
Israel Chauca Fuentes
2015-02-12 09:09:48 -05:00
parent 470c053a3b
commit c78a6e6d93
2 changed files with 4 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ function! s:init() "{{{
call s:option_init("autoclose", 1)
" matchpairs
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')
if len(filter(pairs, 'v:val[0] ==# v:val[1]'))
echohl ErrorMsg

View File

@@ -1,8 +1,8 @@
let g:delimitMate_matchpairs = '(:),{:},[:],<:>,¿:?,¡:!'
let g:delimitMate_matchpairs = '(:),{:},[:],<:>,¿:?,¡:!,,::'
let lines = readfile(expand('<sfile>:t:r').'.txt')
call vimtest#StartTap()
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)
let tcount = 1
let reload = 1
@@ -24,7 +24,7 @@ for item in lines
let reload = 0
endif
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(input2, ')', s:r, 'g')
let output2 = substitute(output, '(', s:l, 'g')