1
- " Vim auto-load script
1
+ " Functions to interact with the user.
2
+ "
2
3
" Author: Peter Odding <peter@peterodding.com>
3
- " Last Change: March 15, 2011
4
+ " Last Change: May 19, 2013
4
5
" URL: http://peterodding.com/code/vim/misc/
5
6
6
7
if ! exists (' g:xolox_message_buffer' )
@@ -12,29 +13,34 @@ if !exists('g:xolox_messages')
12
13
let g: xolox_messages = []
13
14
endif
14
15
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()
18
21
call s: show_message (' title' , a: 000 )
19
22
endfunction
20
23
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.
24
27
call s: show_message (' warningmsg' , a: 000 )
25
28
endfunction
26
29
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'
30
37
if &vbs >= 1
31
38
call s: show_message (' question' , a: 000 )
32
39
endif
33
40
endfunction
34
41
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().
38
44
let nargs = len (a: args )
39
45
if nargs == 1
40
46
let message = a: args [0 ]
@@ -56,7 +62,10 @@ function! s:show_message(hlgroup, args)
56
62
augroup END
57
63
execute ' echohl' a: hlgroup
58
64
" Redraw to avoid |hit-enter| prompt.
59
- redraw | echomsg message
65
+ redraw
66
+ for line in split (message, " \n " )
67
+ echomsg line
68
+ endfor
60
69
if g: xolox_message_buffer > 0
61
70
call add (g: xolox_messages , message)
62
71
if len (g: xolox_messages ) > g: xolox_message_buffer
@@ -70,7 +79,8 @@ function! s:show_message(hlgroup, args)
70
79
endif
71
80
endfunction
72
81
73
- function ! s: clear_message ()
82
+ function ! s: clear_message () " {{{1
83
+ " Callback to clear message after some time has passed.
74
84
echo ' '
75
85
let &more = s: more_save
76
86
let &showmode = s: smd_save
0 commit comments