sponsor Vim development Vim logo Vim Book Ad

auto_autoread.vim : Automatically read files when they've changed. Does what 'autoread' promises.

 script karma  Rating 17/13, Downloaded by 1000  Comments, bugs, improvements  Vim wiki

created by
Martin Tournoij
 
script type
utility
 
description
- Homepage: (http://www.vim.org/scripts/script.php?script_id=5206

-----------------------------------------------------------------------------

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.


 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
download-from-homepage.tar.gz 1.0 2016-10-30 7.0 Martin Tournoij Download from homepage.
ip used for rating: 18.222.240.21

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github