This question has been answered in StackOverflow: How does Vim's autoread work?
Follow explanations in Vim Wikia page Have Vim check automatically if the file has changed externally.
This solution requires the addition of a function to your vimrc file and that a new command is called on the buffers you want to watch.
This solution was proposed by @GregSexton in the question I linked above. The idea is to force the modification check whenever one of the following happens:
- Entering the buffer.
- No key was pressed for 'updatetime'
- Cursor moved.
You can find the code that implements this below:
"silent! necessary otherwise throws errors when using command
autocmd BufEnter * silent! checktime
autocmd CursorHold * silent! checktime
autocmd CursorHoldI * silent! checktime
"these two _may_ slow things down. Remove if they do.
autocmd CursorMoved * silent! checktime
autocmd CursorMovedI * silent! checktime
Add and/or remove
autocmd as best suits your workflow. Check here for the list of events that can be used.
If autoread is also enabled, file will be automatically read if not modified: