mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 21:24:51 +08:00
Fix :DelimitMateTest.
This commit is contained in:
@@ -582,16 +582,8 @@ endfunction " }}}
|
|||||||
|
|
||||||
" Tools: {{{
|
" Tools: {{{
|
||||||
function! delimitMate#TestMappings() "{{{
|
function! delimitMate#TestMappings() "{{{
|
||||||
if &modified
|
echom 1
|
||||||
echohl WarningMsg
|
%d
|
||||||
let answer = input("Modified buffer, type \"yes\" to write and proceed "
|
|
||||||
\ . "with test: ") !~ '\c^yes$'
|
|
||||||
echohl NONE
|
|
||||||
if answer != '\c^yes$'
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
write
|
|
||||||
endif
|
|
||||||
let options = sort(keys(delimitMate#OptionsList()))
|
let options = sort(keys(delimitMate#OptionsList()))
|
||||||
let optoutput = ['delimitMate Report', '==================', '',
|
let optoutput = ['delimitMate Report', '==================', '',
|
||||||
\ '* Options: ( ) default, (g) global, (b) buffer','']
|
\ '* Options: ( ) default, (g) global, (b) buffer','']
|
||||||
@@ -604,8 +596,8 @@ function! delimitMate#TestMappings() "{{{
|
|||||||
|
|
||||||
" Check if mappings were set. {{{
|
" Check if mappings were set. {{{
|
||||||
let imaps = s:g('right_delims')
|
let imaps = s:g('right_delims')
|
||||||
let imaps = imaps + ( s:g('autoclose') ? s:g('left_delims') : [] )
|
let imaps += ( s:g('autoclose') ? s:g('left_delims') : [] )
|
||||||
let imaps = imaps +
|
let imaps +=
|
||||||
\ s:g('quotes_list') +
|
\ s:g('quotes_list') +
|
||||||
\ s:g('apostrophes_list') +
|
\ s:g('apostrophes_list') +
|
||||||
\ ['<BS>', '<S-BS>', '<Del>', '<S-Tab>', '<Esc>'] +
|
\ ['<BS>', '<S-BS>', '<Del>', '<S-Tab>', '<Esc>'] +
|
||||||
@@ -620,13 +612,8 @@ function! delimitMate#TestMappings() "{{{
|
|||||||
\ '<C-ScrollWheelLeft>'] +
|
\ '<C-ScrollWheelLeft>'] +
|
||||||
\ ['<ScrollWheelRight>', '<S-ScrollWheelRight>',
|
\ ['<ScrollWheelRight>', '<S-ScrollWheelRight>',
|
||||||
\ '<C-ScrollWheelRight>']
|
\ '<C-ScrollWheelRight>']
|
||||||
let imaps = imaps + ( s:g('expand_cr') ? ['<CR>'] : [] )
|
let imaps += ( s:g('expand_cr') ? ['<CR>'] : [] )
|
||||||
let imaps = imaps + ( s:g('expand_space') ? ['<Space>'] : [] )
|
let imaps += ( s:g('expand_space') ? ['<Space>'] : [] )
|
||||||
|
|
||||||
let vmaps =
|
|
||||||
\ s:g('right_delims') +
|
|
||||||
\ s:g('left_delims') +
|
|
||||||
\ s:g('quotes_list')
|
|
||||||
|
|
||||||
let imappings = []
|
let imappings = []
|
||||||
for map in imaps
|
for map in imaps
|
||||||
@@ -635,7 +622,7 @@ function! delimitMate#TestMappings() "{{{
|
|||||||
let map = '<Bar>'
|
let map = '<Bar>'
|
||||||
endif
|
endif
|
||||||
redir => output | execute "verbose imap ".map | redir END
|
redir => output | execute "verbose imap ".map | redir END
|
||||||
let imappings = imappings + split(output, '\n')
|
let imappings += split(output, '\n')
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
unlet! output
|
unlet! output
|
||||||
@@ -728,6 +715,7 @@ function! delimitMate#TestMappings() "{{{
|
|||||||
call append(line('$'), split(setoptions,"\n")
|
call append(line('$'), split(setoptions,"\n")
|
||||||
\ + ['--------------------'])
|
\ + ['--------------------'])
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
|
call feedkeys("\<Esc>\<Esc>", 'n')
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! delimitMate#OptionsList() "{{{
|
function! delimitMate#OptionsList() "{{{
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function! s:init() "{{{
|
|||||||
|
|
||||||
" quotes
|
" quotes
|
||||||
call s:option_init("quotes", "\" ' `")
|
call s:option_init("quotes", "\" ' `")
|
||||||
call s:option_init("quotes_list", split(s:g('quotes'), '\zs'))
|
call s:option_init("quotes_list",split(s:g('quotes'), '\s\+'))
|
||||||
|
|
||||||
" nesting_quotes
|
" nesting_quotes
|
||||||
call s:option_init("nesting_quotes", [])
|
call s:option_init("nesting_quotes", [])
|
||||||
@@ -200,30 +200,16 @@ function! s:Unmap() " {{{
|
|||||||
endfunction " }}} s:Unmap()
|
endfunction " }}} s:Unmap()
|
||||||
|
|
||||||
function! s:TestMappingsDo() "{{{
|
function! s:TestMappingsDo() "{{{
|
||||||
%d
|
if &modified
|
||||||
if !exists("g:delimitMate_testing")
|
let confirm = input("Modified buffer, type \"yes\" to write and proceed "
|
||||||
call delimitMate#TestMappings()
|
\ . "with test: ") ==? 'yes'
|
||||||
else
|
if !confirm
|
||||||
let temp_varsDM = [s:g('expand_space'), s:g('expand_cr'), s:g('autoclose')]
|
return
|
||||||
for i in [0,1]
|
endif
|
||||||
let b:delimitMate_expand_space = i
|
|
||||||
let b:delimitMate_expand_cr = i
|
|
||||||
for a in [0,1]
|
|
||||||
let b:delimitMate_autoclose = a
|
|
||||||
call s:init()
|
|
||||||
call s:Unmap()
|
|
||||||
call s:Map()
|
|
||||||
call delimitMate#TestMappings()
|
|
||||||
call append(line('$'),'')
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
let b:delimitMate_expand_space = temp_varsDM[0]
|
|
||||||
let b:delimitMate_expand_cr = temp_varsDM[1]
|
|
||||||
let b:delimitMate_autoclose = temp_varsDM[2]
|
|
||||||
unlet temp_varsDM
|
|
||||||
endif
|
endif
|
||||||
normal gg
|
call delimitMate#TestMappings()
|
||||||
g/\%^$/d
|
g/\%^$/d
|
||||||
|
0
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:DelimitMateDo(...) "{{{
|
function! s:DelimitMateDo(...) "{{{
|
||||||
|
|||||||
Reference in New Issue
Block a user