From 0fb597ef36b8e22327a6824ea409b0c2680777e2 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Sat, 25 Feb 2012 17:45:28 -0500 Subject: [PATCH] Make :DelimitMateTest more verbose. - Add the output of :version. - Print all mapping regardless of value. - Ask before overwriting a modified buffer. --- autoload/delimitMate.vim | 31 +++++++++++++++++-------------- plugin/delimitMate.vim | 4 ++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index 9bcc199..e902026 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -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 = '' - 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 = '' 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 diff --git a/plugin/delimitMate.vim b/plugin/delimitMate.vim index 462feb5..7e4bb00 100644 --- a/plugin/delimitMate.vim +++ b/plugin/delimitMate.vim @@ -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()