If you've made changes, just using
:e!
(or just :e if you haven't modified the buffer since the :w command) will reload the (modified) file from disk. However it has the unfortunate side-effect of losing your undo history.
If you've made changes, just using
:e!
(or just :e if you haven't modified the buffer since the :w command) will reload the (modified) file from disk. However it has the unfortunate side-effect of losing your undo history.
:e
without a filename following it re-edits the current file, re-reading it from disk like you wanted. If you've made changes that it hasn't yet written (which you do with your :w so mostly a non-issue here), the
:e!
means "abandon any unsaved changes and reread the file from disk". I mentally read the "!" modifier on ex commands as "and I mean it" or "dagnabbit".
:w
"The file on disk has been changed since last you wrote it"
:w!
"(over)write the file, dagnabbit!" 😆