Hi Peter

Thank you very much for your time/help. The previous group of commands works really well for me already. I have enjoyed the convenience it's brought so far. A click to update the content was what I wished for, but now I have more than what I wished for!

Many many thanks again
Regards
tien


At 02:41 PM 2/08/2006 +1000, you wrote:
>
> Thank you very much for the tip. ":e" works so nicely. I will try out those
> commands soon. Should I insert them in my vimrc file ?
>

Hi Tien,

Sorry, it seems I was a little naive with that autocommand I showed you, it
doesn't work because CursorHold won't trigger again until you press a key.
After a little experimentation, I think you would best add something like this
to your .vimrc:

  function! s:ReloadWhileWaiting()
    while ! getchar(1)
      edit
      normal G
      sleep 1
    endwhile
  endfunction

  augroup RefreshFile
  autocmd!
  autocmd CursorHold somefile.log call s:ReloadWhileWaiting()
  augroup end

The automatic refresh ('s:ReloadWhileWaiting()') only begins after Vim is idle
for 4 seconds; after that it will reload the file ('edit'), move to the end
('normal G') and wait for a second before it tries again ('sleep 1'). Pressing
any key will stop the automatic refreshing ('while ! getchar(1)'), but it will
resume as soon as Vim is idle for 4 seconds again. I hope that's all clear and
does what you need or that you can customize it easily.

regards,
Peter



Send instant messages to your online friends http://au.messenger.yahoo.com


Reply via email to