diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index abbb2c3..53937b2 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -412,10 +412,8 @@ function! s:keys4cr(info, opts) "{{{1 \|| (a:opts.expand_cr == 2 && !empty(filter(copy(a:opts.pairs), 'strcharpart(v:val, 1, 1) == a:info.cur.n_char'))) " Empty pair echom 71 - let right = a:info.cur.line - let rm_spaces = empty(a:info.cur.behind) ? '' : "\" let eol_marker = a:opts.insert_eol_marker == 2 && strchars(a:info.cur.ahead) == 1 ? a:opts.eol_marker : '' - return rm_spaces . "\x\U\\\" . a:info.cur.n_char . "\" . eol_marker . "\\\" + return "0\\x\U\\\" . a:info.cur.n_char . "\" . eol_marker . "\\\" endif if a:opts.expand_cr && a:opts.expand_inside_quotes \&& !empty(filter(copy(a:opts.quotes), 'v:val.v:val ==# a:info.prev.around')) diff --git a/test/Makefile b/test/Makefile index 30ad0af..2288e7c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ all: build/runVimTests - build/runVimTests/bin/runVimTests.sh -0 . + time build/runVimTests/bin/runVimTests.sh -0 . build/runVimTests: build/VimTAP git clone https://github.com/inkarkat/runVimTests $@ @@ -13,4 +13,4 @@ test_files := $(filter-out _setup.vim,$(wildcard *.vim)) .PHONY: $(test_files) $(test_files): - build/runVimTests/bin/runVimTests.sh -0 $@ + time build/runVimTests/bin/runVimTests.sh -0 $@ diff --git a/test/autoclose_matchpairs.vim b/test/autoclose_matchpairs.vim index 341bce8..dc6cc5b 100644 --- a/test/autoclose_matchpairs.vim +++ b/test/autoclose_matchpairs.vim @@ -12,7 +12,7 @@ call vimtest#StartTap() -call vimtap#Plan(189) +call vimtap#Plan(205) let g:delimitMate_matchpairs = '(:),{:},[:],<:>,¿:?,¡:!,,::' @@ -34,7 +34,10 @@ call DMTest_pairs('\', "a(x", '\(x') call DMTest_pairs('(\)', "la)x", '(\)x)') +call DMTest_pairs('"abc"', "ifoo(", 'foo("abc"') + "call DMTest_pairs('', "(\x", "()x") + let g:delimitMate_autoclose = 0 call DMTest_pairs('', "i(x", "(x") @@ -59,7 +62,7 @@ call DMTest_pairs('(a)', "a)", "()a)") " Expand iabbreviations iabb def ghi -call DMTest_pairs('', "idef(", "ghi()") +call DMTest_single('', "idef(", "ghi()") iunabb def call DMTest_pairs("abc а", "$i(", "abc (а") @@ -81,17 +84,44 @@ call DMTest_pairs("abc (", "$i(", "abc ((") " Play nice with undo. call DMTest_pairs('', "ia\u(c)b\u", "a") -let g:delimitMate_autoclose = 1 +" TODO: way to jump over one or several closing chars +call DMTest_single('()', 'a\x', '()x', 0, 1) + +call DMTest_single('{()}', 'la\x', '{()}x', 0, 1) + let g:delimitMate_balance_pairs = 1 call DMTest_pairs('ab cd)', "la(x", 'ab(x cd)') +" Issue #229 +call DMTest_single('((ab cd)', "A)", '((abx cd))', 0, 1) +unlet g:delimitMate_balance_pairs + +" Issue #220 +let g:delimitMate_jump_over = 0 +call DMTest_single('()', ')', '())', 0, 1) +unlet g:delimitMate_jump_over + +" Issues #207 and #223 +call DMTest_single('{[(foobar)]}', 'fbi]x', '{[(foobar)]x}', 0, 1) + +" Issues #207 and #223 +call DMTest_single('{[(foobar)]}', 'fbi\x', '{[(foobar)]}x', 0, 1) " Disable on syntax groups new syntax on set ft=vim call DMTest_pairs('echo " "', "f\"la(", 'echo " ( "') + +filetype indent plugin on +set ft=php +" Issue #160 +call DMTest_single('\\", '.", 'abc foo(x)foo(x)', 0, 1) + call vimtest#Quit() " vim: sw=2 et diff --git a/test/eol_marker.vim b/test/eol_marker.vim index 7136160..ed8203f 100644 --- a/test/eol_marker.vim +++ b/test/eol_marker.vim @@ -11,7 +11,7 @@ " - Add 5 to vimtap#Plan(). call vimtest#StartTap() -call vimtap#Plan(9) +call vimtap#Plan(10) let g:delimitMate_expand_cr = 1 let g:delimitMate_eol_marker = ';' @@ -34,10 +34,15 @@ call DMTest_single('', 'i(', '()') call DMTest_single('', "i(\x", ['(', 'x', ');']) +" Issue #195 call DMTest_single('', "i{(\x", ['{(', 'x', ')}']) +" Issue #195 call DMTest_single('', "i;\{(\x", ['{(', 'x', ')};']) +" Issue #195 +call DMTest_single('', "i\{(\x", ['{(', 'x', ')};'], 0, 1) + " End: quit vim. call vimtest#Quit() " vim: sw=2 et