mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-06 12:44:27 +08:00
Simplify expand_cr a bit and add some to do tests
This commit is contained in:
@@ -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) ? '' : "\<C-U>"
|
||||
let eol_marker = a:opts.insert_eol_marker == 2 && strchars(a:info.cur.ahead) == 1 ? a:opts.eol_marker : ''
|
||||
return rm_spaces . "\<Del>x\<C-G>U\<Left>\<BS>\<CR>" . a:info.cur.n_char . "\<Del>" . eol_marker . "\<Up>\<End>\<CR>"
|
||||
return "0\<C-D>\<Del>x\<C-G>U\<Left>\<BS>\<CR>" . a:info.cur.n_char . "\<Del>" . eol_marker . "\<Up>\<End>\<CR>"
|
||||
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'))
|
||||
|
||||
@@ -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 $@
|
||||
|
||||
@@ -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('', "(\<S-Tab>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\<C-G>u(c)b\<Esc>u", "a")
|
||||
|
||||
let g:delimitMate_autoclose = 1
|
||||
" TODO: way to jump over one or several closing chars
|
||||
call DMTest_single('()', 'a\<magic>x', '()x', 0, 1)
|
||||
|
||||
call DMTest_single('{()}', 'la\<magic>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\<magic>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('<?php incl', "A\<C-X>\<C-O>\<C-Y>", '<?php include()', 0, 1)
|
||||
syntax off
|
||||
bp
|
||||
|
||||
" This breaks Vim for now, so let's put it at the end
|
||||
" Play nice with redo
|
||||
call DMTest_single('abc ', "Afoo(x\<Esc>.", 'abc foo(x)foo(x)', 0, 1)
|
||||
|
||||
call vimtest#Quit()
|
||||
" vim: sw=2 et
|
||||
|
||||
@@ -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(\<CR>x", ['(', 'x', ');'])
|
||||
|
||||
" Issue #195
|
||||
call DMTest_single('', "i{(\<CR>x", ['{(', 'x', ')}'])
|
||||
|
||||
" Issue #195
|
||||
call DMTest_single('', "i;\<Left>{(\<CR>x", ['{(', 'x', ')};'])
|
||||
|
||||
" Issue #195
|
||||
call DMTest_single('', "i\<Left>{(\<CR>x", ['{(', 'x', ')};'], 0, 1)
|
||||
|
||||
" End: quit vim.
|
||||
call vimtest#Quit()
|
||||
" vim: sw=2 et
|
||||
|
||||
Reference in New Issue
Block a user