Tip38: Manage Hidden Files
January 12, 2021 ยท View on GitHub
When a buffer has been modified, Vim gives it special treatment to ensure that we don't accidentally quit the editor without saving our changes, Find out how to hide a modified buffer and how to handle hidden buffers when quiting Vim.


Handle Hidden Buffers on Quit
When you quit Vim and have unsaved changes in one of buffers. Vim loads the first hidden buffer with modifications into the current window so that we can decide what to do with it.
:write
to save the buffer to a file.
:edit!
to discard the changes(reread the file from disk, overwriting the contents of the buffer)
Vim activates the next unsaved buffer each time we enter the :quit command
:qall!
quit Vim without reviewing our unsaved changes.
:wall
write all modified buffers without reviewing them one by one.

Enable the hidden Setting Before Running :argdo or :bufdo
Be default, Vim prevents us from abandoning a modified buffer.
