When you change a file outside vim, vim notices, and prompts you for action: should it reload the file, and discard any changes you have? should it keep your changes?
Often, just re-reading the buffer is correct. Typically, this occurs:
- Open a file in vim.
- Hack away, save.
- Change branches in git.
- Vim detects the file has changed.
At this point, I really just want the file to get reloaded, as it is saved. (If the buffer isn't saved, the normal prompt is okay.) Me clicking/typing "Load file" is error prone if I have a stray buffer that isn't saved. Seeing that message only for buffers that are modified would be much safer.
Something that does exactly what I want would be great, but I've really got other desires too (diffing a modified buffer would be cool): can you script what happens when a file changes on-disk?