mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-28 15:06:52 +08:00
Make :DelimitMateTest more verbose.
- Add the output of :version. - Print all mapping regardless of value. - Ask before overwriting a modified buffer.
This commit is contained in:
@@ -487,6 +487,15 @@ endfunction " }}}
|
|||||||
|
|
||||||
" Tools: {{{
|
" Tools: {{{
|
||||||
function! delimitMate#TestMappings() "{{{
|
function! delimitMate#TestMappings() "{{{
|
||||||
|
if &modified
|
||||||
|
echohl WarningMsg
|
||||||
|
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', '==================', '', '* Options: ( ) default, (g) global, (b) buffer','']
|
let optoutput = ['delimitMate Report', '==================', '', '* Options: ( ) default, (g) global, (b) buffer','']
|
||||||
for option in options
|
for option in options
|
||||||
@@ -511,24 +520,18 @@ function! delimitMate#TestMappings() "{{{
|
|||||||
\ b:_l_delimitMate_left_delims +
|
\ b:_l_delimitMate_left_delims +
|
||||||
\ b:_l_delimitMate_quotes_list
|
\ b:_l_delimitMate_quotes_list
|
||||||
|
|
||||||
let ibroken = []
|
let imappings = []
|
||||||
for map in imaps
|
for map in imaps
|
||||||
if maparg(map, "i") !~? 'delimitMate'
|
let output = ''
|
||||||
let output = ''
|
if map == '|'
|
||||||
if map == '|'
|
let map = '<Bar>'
|
||||||
let map = '<Bar>'
|
|
||||||
endif
|
|
||||||
redir => output | execute "verbose imap ".map | redir END
|
|
||||||
let ibroken = ibroken + [map.": is not set:"] + split(output, '\n')
|
|
||||||
endif
|
endif
|
||||||
|
redir => output | execute "verbose imap ".map | redir END
|
||||||
|
let imappings = imappings + split(output, '\n')
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
unlet! output
|
unlet! output
|
||||||
if ibroken == []
|
let output = ['* Mappings:', ''] + imappings + ['--------------------', '']
|
||||||
let output = ['* Mappings:', '', 'All mappings were set-up.', '--------------------', '', '']
|
|
||||||
else
|
|
||||||
let output = ['* Mappings:', ''] + ibroken + ['--------------------', '']
|
|
||||||
endif
|
|
||||||
call append('$', output+['* Showcase:', ''])
|
call append('$', output+['* Showcase:', ''])
|
||||||
" }}}
|
" }}}
|
||||||
if b:_l_delimitMate_autoclose
|
if b:_l_delimitMate_autoclose
|
||||||
@@ -593,7 +596,7 @@ function! delimitMate#TestMappings() "{{{
|
|||||||
call append(line('$'), '')
|
call append(line('$'), '')
|
||||||
endfor
|
endfor
|
||||||
endif "}}}
|
endif "}}}
|
||||||
redir => setoptions | set | filetype | redir END
|
redir => setoptions | set | filetype | version | redir END
|
||||||
call append(line('$'), split(setoptions,"\n")
|
call append(line('$'), split(setoptions,"\n")
|
||||||
\ + ['--------------------'])
|
\ + ['--------------------'])
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ endfunction " }}} s:Unmap()
|
|||||||
function! s:TestMappingsDo() "{{{
|
function! s:TestMappingsDo() "{{{
|
||||||
%d
|
%d
|
||||||
if !exists("g:delimitMate_testing")
|
if !exists("g:delimitMate_testing")
|
||||||
silent call delimitMate#TestMappings()
|
call delimitMate#TestMappings()
|
||||||
else
|
else
|
||||||
let temp_varsDM = [b:_l_delimitMate_expand_space, b:_l_delimitMate_expand_cr, b:_l_delimitMate_autoclose]
|
let temp_varsDM = [b:_l_delimitMate_expand_space, b:_l_delimitMate_expand_cr, b:_l_delimitMate_autoclose]
|
||||||
for i in [0,1]
|
for i in [0,1]
|
||||||
@@ -412,7 +412,7 @@ call s:DelimitMateDo()
|
|||||||
command! -bar DelimitMateReload call s:DelimitMateDo(1)
|
command! -bar DelimitMateReload call s:DelimitMateDo(1)
|
||||||
|
|
||||||
" Quick test:
|
" Quick test:
|
||||||
command! -bar DelimitMateTest silent call s:TestMappingsDo()
|
command! -bar DelimitMateTest call s:TestMappingsDo()
|
||||||
|
|
||||||
" Switch On/Off:
|
" Switch On/Off:
|
||||||
command! -bar DelimitMateSwitch call s:DelimitMateSwitch()
|
command! -bar DelimitMateSwitch call s:DelimitMateSwitch()
|
||||||
|
|||||||
Reference in New Issue
Block a user