When a file I’m working on changes on disk, Atom never alerts me and prompts me to reload the file. This might have to do with some delay as my files are on a mounted network drive (CIFS share mounted on Mac with an auto_cifs entry). Is there a manual way to force Atom to re-read the files from disk? Most other editors do this automatically, but I’d be OK with manually forcing it if that’s necessary.
There is an official package that can revert a buffer: https://atom.io/packages/revert-buffer
It doesn’t come with a keymap or menu items so you will want to assign your own keys to
Thanks! I kept searching for ‘reload’ and not getting anything I wanted. Works like a champ.
The apm catalog should support tags for searching.
According to @thedaniel, it supports keyword searching:
Of course, this requires people to add keywords to their packages.
Out of curiosity - is there any hot key binding for reloading a file now? I want to reload a file when it is modified by another program.
Atom automatically reloads the contents of a file that is open and not marked dirty.
This is not the case for me. In fact, if I make some change for a file which is open by Atom and give up all the changes by
git checkout ., all changes are gone, but there is no reflection on Atom. Atom doesn’t automatically reload the change I made by git. I use Ubuntu Linux.
BTW, what do you mean by “marked dirty”? I’m relatively new to Atom.
“Marked dirty” generally means that the file in memory has been changed in comparison to the file on disk. This is typically, but not always, because you’ve edited the file after loading it.
That’s because when you made some change to the file in memory, i.e. it was marked dirty.
Then in such a case, how can I force a reload manually? Any hot key binding for reload?
No, there isn’t a feature for that, though it may be achievable through the API (though I would like to close any such holes if there are).
I just tested, and if the file is clean, it automatically updates when a new version gets saved to disk. I can type words into Notepad++ and they automatically show up in Atom as soon as I save. This means that all you have to do is make sure the file stays clean when it might be edited from the outside.
This appears not to be true with a network drive. I have a VM running on my mac and Atom accessing files on the VM through a mounted drive. This all works fine, but when the mount gets messed up, Atom acts in one of two ways. It crashes most of the time, but so far, each time it has asked me if I want to re-open and it brings me back to what I had open. The other behavior is that it blanks out my file, even if the mount is recreated and the file is there again.
Sublime recovers gracefully in this situation but for other features/reasons I have been exploring using Atom. I like Atom’s editor features/functions better but if it is crashing and losing my files all the time, it makes the program unusable. I’ll try adding in the revert-buffer package but it would be nice if Atom wasn’t so klunky in this situation.
Same for me. I’m using Atom on a sshfs client and there doesn’t seem to be any way to get Atom to refresh the buffer short of closing the file and reopening it. A manual reload/reload all feature would be nice to have.
I just added reload and conflict checking on mounted file systems to my file-watcher package.
fs.watchFile to handle this and my limited testing was successful, but please let me know if it doesn’t work for you. There may be a slight delay as I am using the default polling time of 5 seconds.