Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can vim monitor realtime changes to a file

Tags:

vim

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?

like image 958
Patrick Avatar asked Jan 28 '10 21:01

Patrick


1 Answers

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.

like image 182
Peter Avatar answered Sep 21 '22 07:09

Peter