How do you reload all vim windows at once?

Vim

Vim Problem Overview


I have a few files open in vim, in multiple windows. Is there a command like :e that will reload the buffers for all the files I have open? I need this because I sometime alter some of the files with another editor while they are also open in vim.

Vim Solutions


Solution 1 - Vim

The :windo command does for windows what :bufdo does for buffers. That is:

 :windo e

should cycle through all visible windows (i.e, not windows on other tabs, if any) and execute the :e command. Likewise:

 :bufdo e

would cycle through all buffers in the buffer list (i.e., no "hidden" buffers) and execute the same command.

Note that you may have buffers in the buffer list that are not currently displayed in any window. So whether to use :windo e or :bufdo e depends on what you want.

Relevant help is here: http://vimdoc.sourceforge.net/htmldoc/windows.html#list-repeat

Solution 2 - Vim

Vim will automatically reload buffers that have been changed externally (and don't have unsaved changes) if you set the 'autoread' option.

Solution 3 - Vim

What about

:bufdo e

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondanView Question on Stackoverflow
Solution 1 - VimHerbert SitzView Answer on Stackoverflow
Solution 2 - VimjamessanView Answer on Stackoverflow
Solution 3 - VimWernightView Answer on Stackoverflow