Wolfgang Schmidt wrote:
        Hi,

I want to use vim to watch the output of another program (logfile, compilation output, ...). I want to have something like the functionality of the unix "tail" command, that is, if something new is written to the file, I want the buffer to get updated. I know I can reload the file manually with ":e", but I want it to be done automatically. I tried the autoread option (":set ar"), but I still have to reload the buffer by hand, the buffer does not get updated automatically. Could anybody tell me, how autoread is supposed to work?

Thanx in advance

   Wolfgang

If Vim detects that a file has been changed outside Vim and not inside Vim, 'autoread' will make Vim reread it automatically. But that auto-read won't happen if you do nothing. Vim checks timestamps after invoking the shell, and when you issue the ":checktime" command. Even if you add

  :au CursorHold,CursorHoldI * checktime

the check will be triggered *once* if you wait for 'updatetime' milliseconds without doing anything, then it won't be retriggered until you hit a key.

You could also use

  :map <F7> :checktime<CR>
  :map! <F7> <C-O>:checktime<CR>

then hit F7 periodically to see if anything has been added. Etc...


Best regards,
Tony.

Reply via email to