Vim editor: how to refresh / reload an opened file

04.11.2015
1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.80 out of 5)
Loading...

If you are editing a file that has been modified by some external program, it can be refreshed with the command :edit without any parameters, or simply :e. If you have modified the file locally, you may lose modifications after refreshing the file using :e!.

It is not obvious and convenient for those who use cvs, svn, git, etc.

On-topic options

Note that auto-reading occurs only in the case of user-defined events, i.e. the user is working with the editor. Although, if you want to convert VIM into the analogue of tail -f, you can do the following:

:set nolz | while 1 | e | redraw | $ | 1 sleep | endw

You can break this endless cycle by pressing ctrl-c

Leave a Reply

Your email address will not be published. Required fields are marked *