1- " Vim auto-load script
1+ " Functions to interact with the user.
2+ "
23" Author: Peter Odding <[email protected] >3- " Last Change: March 15, 2011
4+ " Last Change: May 19, 2013
45" URL: http://peterodding.com/code/vim/misc/
56
67if ! exists (' g:xolox_message_buffer' )
@@ -12,29 +13,34 @@ if !exists('g:xolox_messages')
1213 let g: xolox_messages = []
1314endif
1415
15- " Show a formatted informational message to the user.
16-
17- function ! xolox#misc#msg#info (... )
16+ function ! xolox#misc#msg#info (... ) " {{{1
17+ " Show a formatted informational message to the user. This function has the
18+ " same argument handling as Vim's [printf()] [printf] function.
19+ "
20+ " [printf]: http://vimdoc.sourceforge.net/htmldoc/eval.html#printf()
1821 call s: show_message (' title' , a: 000 )
1922endfunction
2023
21- " Show a formatted warning message to the user.
22-
23- function ! xolox#misc#msg#warn ( ... )
24+ function ! xolox#misc#msg#warn ( ... ) " {{{1
25+ " Show a formatted warning message to the user. This function has the same
26+ " argument handling as Vim's [printf()] [printf] function.
2427 call s: show_message (' warningmsg' , a: 000 )
2528endfunction
2629
27- " Show a formatted debugging message to the user?
28-
29- function ! xolox#misc#msg#debug (... )
30+ function ! xolox#misc#msg#debug (... ) " {{{1
31+ " Show a formatted debugging message to the user, if the user has enabled
32+ " increased verbosity by setting Vim's ['verbose'] [verbose] option to one
33+ " (1) or higher. This function has the same argument handling as Vim's
34+ " [printf()] [printf] function.
35+ "
36+ " [verbose]: http://vimdoc.sourceforge.net/htmldoc/options.html#'verbose'
3037 if &vbs >= 1
3138 call s: show_message (' question' , a: 000 )
3239 endif
3340endfunction
3441
35- " The implementation of info() and warn().
36-
37- function ! s: show_message (hlgroup, args )
42+ function ! s: show_message (hlgroup, args ) " {{{1
43+ " The implementation of info() and warn().
3844 let nargs = len (a: args )
3945 if nargs == 1
4046 let message = a: args [0 ]
@@ -56,7 +62,10 @@ function! s:show_message(hlgroup, args)
5662 augroup END
5763 execute ' echohl' a: hlgroup
5864 " Redraw to avoid |hit-enter| prompt.
59- redraw | echomsg message
65+ redraw
66+ for line in split (message, " \n " )
67+ echomsg line
68+ endfor
6069 if g: xolox_message_buffer > 0
6170 call add (g: xolox_messages , message)
6271 if len (g: xolox_messages ) > g: xolox_message_buffer
@@ -70,7 +79,8 @@ function! s:show_message(hlgroup, args)
7079 endif
7180endfunction
7281
73- function ! s: clear_message ()
82+ function ! s: clear_message () " {{{1
83+ " Callback to clear message after some time has passed.
7484 echo ' '
7585 let &more = s: more_save
7686 let &showmode = s: smd_save
0 commit comments