Quite often I am working with files that are version controlled, so it is possible for changes to be made to them outside of Vim.

What is a quick way to reload the file without having to close and reopen Vim? And is there a way to do this automatically?

  • " Compare buffer with saved version nnoremap gd :DiffSaved<CR>
    – Tom Hale
    Commented Sep 2, 2016 at 14:24
  • 3
    If you have installed vim-faq, you can get an offline answer there: :h vim-faq and search /reload. The hard to memorize tag is :h faq-5.8.
    – Hotschke
    Commented Jul 23, 2019 at 7:44

6 Answers 6


The command you want is :e (short for :edit). If you use :edit! it will discard local changes and reload.

You can also have vim do this automatically with set autoread in your vimrc.

  • 12
    See this answer for caveats and solutions regarding autoread.
    – Tom Hale
    Commented Aug 1, 2017 at 3:58
  • 10
    To do this for all buffers, use :bufdo :e or :bufdo :e!
    – Aaron H.
    Commented Nov 13, 2018 at 21:50
  • 2
    @AaronH. thank you for that! i usually have hundreds of buffers open at a time and when switching branches, I usually just close down vim and restart to refresh all of the buffers with new contents. This will be a major timesaver!
    – g19fanatic
    Commented Dec 13, 2018 at 13:42
  • 5
    @AaronH. The second : is optional: :bufdo e will work the same.
    – JoL
    Commented Apr 26, 2019 at 1:07
  • nnoremap <leader>w :write \| sleep 1000m \| :checktime<CR> 1s is the time taken by the linting tool to operate on the file. If you are using the default <leader>, type \w to trigger the action.
    – rodvlopes
    Commented Mar 27, 2020 at 23:28

In many cases, set autoread will not work as this answer explains:

Autoread does not reload file unless you do something like run external command (like !ls or !sh etc)

Focus events will trigger autoread, but these are not captured unless using gvim. So, if running plain vim inside a terminal window or tmux, install the plugin vim-tmux-focus-events.

On tmux versions > 1.9, you'll need to add in .tmux.conf:

set -g focus-events on

For additional goodness, adding the following to your vimrc will trigger autoread when changing buffers inside while inside vim:

au FocusGained,BufEnter * :checktime

If you've ever run an external command from Vim that modifies the current buffer, you may have noticed that it prompts you to reload the file since changes have been made to disk. You can actually invoke this prompt using the :checktime command.


Nice plugin to improve autoread https://github.com/djoshea/vim-autoread

Automatically causes vim to reload files which have been written on disk but not modified in the buffer since the last write from vim. This enables a file open in vim to be edited using another application and saved. Upon returning to vim, as long as you haven't modified the file since the last change, the file will be automatically updated to reflect the changes made on disk, as though you had pressed :e manually.

  • This was the best solution for me since vim-tmux-focus-events is made obsolete with vim 8.2.2345 . In this way, I also could avoid any other adjustments, such as with tmux config. Combined with rolf007's multiplayer extension, simultaneous editing of files works effortlessly. CoVim did not work well because it was abandoned and python2 is less available. Commented Nov 29, 2023 at 1:04

I had the problem of looking at contents of a file, update the file externally, display the changed file and have the option to edit it when needed. I solved it with the Vim server/remote command line options, inspired by this answer.

With the following commands a file can be reloaded via an external command. First, open the file in question with Vim, while starting a server instance.

vim --servername JABBERWOCKY /tmp/alice.log

Let's assume the file has been changed externally, e.g. by a echo "Curiouser and curiouser" >> /tmp/alice.log. When necessary, send a command to the server instance to reload the file. This command will finish quickly and not spawn a new editor.

vim --servername JABBERWOCKY --remote-send ":e<CR>"

If the opened file was changed in Vim and externally, there will be a conflict during reload (a warning message will appear). For that case a decision has to be made: Leave it with that and keep changes in Vim, or discard local changes and force a reload.

The command with --remote-send above requires manual reloading. However, that command could be tied to a simple loop, using Bash's for/while, or using a hacky one-liner in Linux/Unix:

watch -n 1 'vim --servername JABBERWOCKY --remote-send ":e<CR>"'

Although not tested, I'm certain that something like this could be realized in PowerShell, too.

On Linux/Unix an event-driven approach can be realized by listening to file system events using e.g. the inotify library, if your not using too crazy file systems. Personally I like using the tool entr a lot, which seems to be included in major Linux distributions. Then I get:

echo /tmp/alice.log | entr vim --servername JABBERWOCKY --remote-send ":e<CR>"

It's easy, it's :e!, but you'll lose any changes in your buffer so be careful.

  • How's this different from the accepted answer?
    – Friedrich
    Commented Feb 20 at 18:07
  • @Friedrich there's no ! in the short form; But honestly I figured it out and didn't see the accepted answer; it's kinda long.
    – leeand00
    Commented Feb 20 at 18:16
  • 1
    So this one's for people who fail to figure out :e! is short for :edit! after being told :e was short for :edit. You may have a point ...
    – Friedrich
    Commented Feb 20 at 18:26
  • 1
    but you'll lose any changes in your buffer, :h 'undoreload' Commented Feb 21 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.