Can vim monitor realtime changes to a file

vim

Solution

You can `:set autoread` so that vim reads the file when it changes. However (depending on your platform), you have to give it focus.

From the help:

When a file has been detected to have been changed outside of Vim and it has not been changed inside of Vim, automatically read it again. When the file has been deleted this is not done.

Problem

My question is similar to this how to monitor a text file in realtime but I want to do it in vim. I know I can read an opened file use `tail -f sample.xml` file, and when new content is written to the file, it'll also write the new content to my screen. Can I have vim automatically fill the new data when a file is updated?

Original source

Related problems