A point that I think is relevant here. Which basically comes down to, "Why would one bother?" And helps to decide which solution to choose.
Let me start with terminology. There are active buffers (buffers which are open in some window, even if the window is not visible at the moment, e.g. on a different tab). When you abandon a buffer
b (switch to some other buffer, or close some window, and
b is no longer displayed in any window, including the non-visible ones),
b becomes hidden if
&hidden and unloaded otherwise.
From what I can see after executing a shell command (
checktime. That is, it checks every active buffer and asks if the user wants to reload it (
:bufdo executes a command in every buffer, including hidden and unloaded).
vim also checks if a buffer needs to be reloaded when the user switches to it. If the buffer was unloaded, it simply loads it (which makes sense). If the user switches to a hidden buffer,
vim asks if the buffer should be reloaded.
When you do
- content in the buffers (possibly stale) in case of active and hidden buffers
- content on the disk if case of unloaded buffers
Now let's say you're working on a project, have an active buffer
b and switch to some other commit (
:!git checkout ...). In this case
vim asks you if you want to reload
b if it was changed.
b was hidden, and before the switch a variable
someName was mentioned in the file. But after the switch the variable is named
vim will not ask you if you want to reload
b. Then you do
:lvim someOtherName **/*, and in this case
vim will not find matches in
This is no argument against hidden buffers, but something to be aware of.