diff options
Diffstat (limited to 'autoload/xolox/misc/timer.vim')
-rw-r--r-- | autoload/xolox/misc/timer.vim | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/autoload/xolox/misc/timer.vim b/autoload/xolox/misc/timer.vim index d7fc32d..31072f5 100644 --- a/autoload/xolox/misc/timer.vim +++ b/autoload/xolox/misc/timer.vim @@ -1,7 +1,7 @@ " Timing of long during operations. " " Author: Peter Odding <peter@peterodding.com> -" Last Change: May 19, 2013 +" Last Change: May 20, 2013 " URL: http://peterodding.com/code/vim/misc/ if !exists('g:timer_enabled') @@ -17,10 +17,7 @@ let s:has_reltime = has('reltime') function! xolox#misc#timer#start() " {{{1 " Start a timer. This returns a list which can later be passed to " `xolox#misc#timer#stop()`. - if g:timer_enabled || &verbose >= g:timer_verbosity - return s:has_reltime ? reltime() : [localtime()] - endif - return [] + return s:has_reltime ? reltime() : [localtime()] endfunction function! xolox#misc#timer#stop(...) " {{{1 @@ -40,6 +37,14 @@ function! xolox#misc#timer#stop(...) " {{{1 endif endfunction +function! xolox#misc#timer#force(...) " {{{1 + " Show a formatted message to the user. This function has the same argument + " handling as Vim's [printf()] [printf] function with one difference: At the + " point where you want the elapsed time to be embedded, you write `%s` and + " you pass the list returned by `xolox#misc#timer#start()` as an argument. + call call('xolox#misc#msg#info', map(copy(a:000), 's:convert_value(v:val)')) +endfunction + function! s:convert_value(value) " {{{1 if type(a:value) != type([]) return a:value |