mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-06 12:44:27 +08:00
Small fixes and documentation updates.
This commit is contained in:
@@ -115,7 +115,7 @@ endfunction "}}}
|
||||
|
||||
function! delimitMate#IsCRExpansion() " {{{
|
||||
let nchar = getline(line('.')-1)[-1:]
|
||||
let schar = getline(line('.')+1)[-1:]
|
||||
let schar = getline(line('.')+1)[:0]
|
||||
let isEmpty = getline('.') == ""
|
||||
if index(b:delimitMate_left_delims, nchar) > -1 &&
|
||||
\ index(b:delimitMate_left_delims, nchar) == index(b:delimitMate_right_delims, schar) &&
|
||||
@@ -375,7 +375,7 @@ function! delimitMate#Finish() " {{{
|
||||
let buffer = join(b:delimitMate_buffer, '')
|
||||
let line = getline('.')
|
||||
let col = col('.') -2
|
||||
echom 'col: ' . col . '-' . line[:col] . "|" . line[col+len+1:] . '%' . buffer
|
||||
"echom 'col: ' . col . '-' . line[:col] . "|" . line[col+len+1:] . '%' . buffer
|
||||
call setline('.', line[:col] . line[col+len+1:])
|
||||
let i = 1
|
||||
let lefts = ''
|
||||
@@ -469,14 +469,14 @@ function! delimitMate#ExtraMappings() "{{{
|
||||
inoremap <buffer> <Esc> <C-R>=delimitMate#Finish()<CR><Esc>
|
||||
|
||||
" Flush the char buffer on mouse click:
|
||||
inoremap <buffer> <LeftMouse> <C-R>=delimitMate#FlushBuffer()<CR><LeftMouse>
|
||||
inoremap <buffer> <RightMouse> <C-R>=delimitMate#FlushBuffer()<CR><RightMouse>
|
||||
inoremap <buffer> <LeftMouse> <C-R>=delimitMate#Finish()<CR><LeftMouse>
|
||||
inoremap <buffer> <RightMouse> <C-R>=delimitMate#Finish()<CR><RightMouse>
|
||||
|
||||
" Flush the char buffer on key movements:
|
||||
inoremap <buffer> <Left> <C-R>=delimitMate#FlushBuffer()<CR><Left>
|
||||
inoremap <buffer> <Right> <C-R>=delimitMate#FlushBuffer()<CR><Right>
|
||||
inoremap <buffer> <Up> <C-R>=delimitMate#FlushBuffer()<CR><Up>
|
||||
inoremap <buffer> <Down> <C-R>=delimitMate#FlushBuffer()<CR><Down>
|
||||
inoremap <buffer> <Left> <C-R>=delimitMate#Finish()<CR><Left>
|
||||
inoremap <buffer> <Right> <C-R>=delimitMate#Finish()<CR><Right>
|
||||
inoremap <buffer> <Up> <C-R>=delimitMate#Finish()<CR><Up>
|
||||
inoremap <buffer> <Down> <C-R>=delimitMate#Finish()<CR><Down>
|
||||
|
||||
inoremap <buffer> <Del> <C-R>=delimitMate#Del()<CR>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function! delimitMateTests#Main() " {{{
|
||||
if !exists("g:delimitMate_testing")
|
||||
echoerr "delimitMateTests#Main(): You shouldn't use this function!"
|
||||
echoerr "delimitMateTests#Main(): If you really want to use me, you must set delimitMate_testing to any value."
|
||||
return
|
||||
endif
|
||||
nmap <F1> :qall!<CR>
|
||||
@@ -10,7 +10,7 @@ function! delimitMateTests#Main() " {{{
|
||||
let b:delimitMate_autoclose = 1
|
||||
let b:delimitMate_matchpairs = &matchpairs
|
||||
let b:delimitMate_quotes = "\" ' `"
|
||||
let b:delimitMate_excluded_regions = ["Comment"]
|
||||
let b:delimitMate_excluded_regions = "Comment"
|
||||
silent! unlet b:delimitMate_visual_leader
|
||||
let b:delimitMate_expand_space = 0
|
||||
let b:delimitMate_expand_cr = 0
|
||||
@@ -45,7 +45,6 @@ function! delimitMateTests#Main() " {{{
|
||||
let text = text . "<cr>" . getline(i)
|
||||
let i += 1
|
||||
endwhile
|
||||
echom "text: " . text
|
||||
if result == 0
|
||||
exec "let b:test_results['" . substitute(a:name, "[^a-zA-Z0-9_]", "_", "g") . "'] = 'Passed: ' . text . ' == ' . join(a:output, '<cr>')"
|
||||
else
|
||||
@@ -58,7 +57,6 @@ function! delimitMateTests#Main() " {{{
|
||||
call setpos('.', [0, 1, 1, 0])
|
||||
let result = len(a:output) != line('$')
|
||||
for line in a:output
|
||||
echom line . " vs " . getline('.')
|
||||
if getline('.') != line || result == 1
|
||||
let result = 1
|
||||
break
|
||||
@@ -129,13 +127,21 @@ function! delimitMateTests#Main() " {{{
|
||||
call RepeatLast("S Tab", ["()|()|"])
|
||||
|
||||
" Space expansion
|
||||
call Type("Space expansion", "(\<Space>", ['( | )'], ['expand_space:1'])
|
||||
call Type("Space expansion", "(\<Space>\<BS>", ['(|)'], ['expand_space:1'])
|
||||
call RepeatLast("BS with space expansion", ['(|)(|)'])
|
||||
|
||||
" BS with space expansion
|
||||
call Type("BS with space expansion", "(\<Space>", ['( | )'], ['expand_space:1'])
|
||||
call RepeatLast("Space expansion", ['( | )( | )'])
|
||||
|
||||
" Car return expansion
|
||||
call Type("CR expansion", "(\<CR>", ['(', '|', ')'], ['expand_cr:1'])
|
||||
call RepeatLast("CR expansion", ['(', '|', ')(', '|', ')'])
|
||||
|
||||
" BS with car return expansion
|
||||
call Type("BS with CR expansion", "(\<CR>\<BS>", ['(|)'], ['expand_cr:1'])
|
||||
call RepeatLast("BS with CR expansion", ['(|)(|)'])
|
||||
|
||||
" Visual wrapping
|
||||
call Type("Visual wrapping left paren", "1234\<Esc>v,(", ['123(4)'], ['visual_leader:","'])
|
||||
cal RepeatLast("Visual wrapping left paren", ['(1)23(4)'])
|
||||
@@ -216,8 +222,4 @@ function! delimitMateTests#Main() " {{{
|
||||
hi def link resultInequal Error
|
||||
" }}}
|
||||
endfunction " }}}
|
||||
|
||||
function! delimitMateTests#Go()
|
||||
call system("gvim -c 'call delimitMateTests\#Main()'")
|
||||
endfunction
|
||||
" vim:foldmethod=marker:foldcolumn=4
|
||||
|
||||
Reference in New Issue
Block a user