Automatically read files when they’ve changed, This does what ‘autoread’ promises to do but doesn’t do. This plugin requires +python or +python3.

The 'autoread' setting only checks if the file is changed when certain events happen (buffer is entered, focus changed, etc.). If you’re not triggering those events, the buffer won’t be updated. To be more precise, this is when:

- `:checktime` is used;
- a buffer is entered;
- `:diffupdate` is used;
- `:e` is issued for a file that already has a buffer;
- executing an external command with `!`;
- returning to the foreground (^Z, fg, only if the shell has job control).

And for gVim, this is also done when:

- closing the "right-click" menu (either by selecting something, or just
  by closing it);
- focus is changed (this is what you already noticed);
- closing the file browsers dialog that pops up if you use "file -> open",
  "file -> save as" from the menu (as well as some other places).

As you can see, this set is very limited. If you’re running Vim in another window while you’re doing something else somewhere else, the buffer never gets updated.

There are some other scripts/tips which promise to fix this, but all of those that I tried simply extend the list of events with CursorMoved, CursorHold, etc.

This plugin will periodically check if the file on the disk has changed with :checktime, It will do this even if you’re not interacting with Vim at all.

Copyright © 2010–2018 Martin Tournoij <martin@arp242.net>
This document is licensed under a cc-by 4.0 license.