Jul 11, 2011

A Sleep function for VIM

I need to let VIM wait for cscope.exe to rebuild the tag file, but there are no build-in sleep function for VIM, so I made one here:

"a sleep function which allows vim to wait for the other processes to finish
com! -complete=command -nargs=+ Sleep call s:Sleep(<q-args>)
fun! s:Sleep(millisec)
  let ct = localtime()
  let dt = 0
  while dt < (a:millisec/1000)
    let dt = localtime() - ct
  endwhile
endfun

Just put it into your _vimrc.
To invoke it, type ":Sleep 10000" to let VIM wait for 10 secs.

0 comments:

 
TEMPLATE HACKS AND TWEAKS BY [ METAMUSE ] BLACKCAT 1.1
/scripts/shBrushJScript.js'/>