Reputation: 605
I'm trying to write a plugin for vim with vimscript
and I want to show some log
for specefic time. like:
echo 'some log'
sleep 2
redraw!
When I use sleep
and redraw
, all of current window freezing for a while but I want sleep just for logs, not all vim window!
How can I do that?
Upvotes: 4
Views: 581
Reputation: 2320
sleep
will always block. With VIM version 8 you can use timer
instead. Here is a stripped down example should not block VIM:
echo 'some log'
let timer = timer_start(2000, 'LogTrigger', {})
func! LogTrigger(timer)
silent! redraw!
endfunc
Upvotes: 5