Skip to content

Latest commit

 

History

History
37 lines (20 loc) · 1.12 KB

tip38.md

File metadata and controls

37 lines (20 loc) · 1.12 KB

Tip38: Manage Hidden Files

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.

tip38_1

tip38_2

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.

tip38_3

Enable the hidden Setting Before Running :argdo or :bufdo

Be default, Vim prevents us from abandoning a modified buffer.

tip38_4