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:
Israel Chauca Fuentes
2012-02-25 17:45:28 -05:00
parent fe5dd9a61a
commit 0fb597ef36
2 changed files with 19 additions and 16 deletions

View File

@@ -487,6 +487,15 @@ endfunction " }}}
" Tools: {{{
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 optoutput = ['delimitMate Report', '==================', '', '* Options: ( ) default, (g) global, (b) buffer','']
for option in options
@@ -511,24 +520,18 @@ function! delimitMate#TestMappings() "{{{
\ b:_l_delimitMate_left_delims +
\ b:_l_delimitMate_quotes_list
let ibroken = []
let imappings = []
for map in imaps
if maparg(map, "i") !~? 'delimitMate'
let output = ''
if map == '|'
let map = '<Bar>'
endif
redir => output | execute "verbose imap ".map | redir END
let ibroken = ibroken + [map.": is not set:"] + split(output, '\n')
let output = ''
if map == '|'
let map = '<Bar>'
endif
redir => output | execute "verbose imap ".map | redir END
let imappings = imappings + split(output, '\n')
endfor
unlet! output
if ibroken == []
let output = ['* Mappings:', '', 'All mappings were set-up.', '--------------------', '', '']
else
let output = ['* Mappings:', ''] + ibroken + ['--------------------', '']
endif
let output = ['* Mappings:', ''] + imappings + ['--------------------', '']
call append('$', output+['* Showcase:', ''])
" }}}
if b:_l_delimitMate_autoclose
@@ -593,7 +596,7 @@ function! delimitMate#TestMappings() "{{{
call append(line('$'), '')
endfor
endif "}}}
redir => setoptions | set | filetype | redir END
redir => setoptions | set | filetype | version | redir END
call append(line('$'), split(setoptions,"\n")
\ + ['--------------------'])
setlocal nowrap

View File

@@ -193,7 +193,7 @@ endfunction " }}} s:Unmap()
function! s:TestMappingsDo() "{{{
%d
if !exists("g:delimitMate_testing")
silent call delimitMate#TestMappings()
call delimitMate#TestMappings()
else
let temp_varsDM = [b:_l_delimitMate_expand_space, b:_l_delimitMate_expand_cr, b:_l_delimitMate_autoclose]
for i in [0,1]
@@ -412,7 +412,7 @@ call s:DelimitMateDo()
command! -bar DelimitMateReload call s:DelimitMateDo(1)
" Quick test:
command! -bar DelimitMateTest silent call s:TestMappingsDo()
command! -bar DelimitMateTest call s:TestMappingsDo()
" Switch On/Off:
command! -bar DelimitMateSwitch call s:DelimitMateSwitch()