John Little wrote:
Hi all

No one has mentioned the feedkeys() work-around (ahem, swallow) for
this, if you want periodic events.  For example,

   function! Timer()
       echo strftime("%c")
       let K_IGNORE = "\x80\xFD\x35"   " internal key code that is ignored
       call feedkeys(K_IGNORE)
   endfunction
   au CursorHold,CursorHoldI * :call Timer()

turns vim into a clock.  It doesn't work in visual, command, and
operator pending mode.  I use it as a tail -f viewer (replace the echo
with checktime | normal G) for log files I want to have syntax
highlighted, a practice I find really helpful.

Regards, John Little


If it works, it also turns the CursorHold[I] events frome one-shot timers to repeat clocks, so invoke the function (replacing the :echo by nothing) then trigger anything that must be called repeatedly from _another_ CursorHold,CursorHoldI autocommand (which may be defined in a different script).

If this timer autocommand is defined in its own augroup (let's say timerrepeat) you can turn it off easily: ":au! timerrepeat".

Warning: It is possible that some plugins expect the CursorHold[I] events to fire only once in periods of inactivity of any duration.


Best regards,
Tony.
--
Said a horny young girl from Milpitas,
"My favorite sport is coitus."
        But a fullback from State
        Made her period late,
And now she has athlete's fetus

Reply via email to