7.4. Manage Hidden Buffers - shinokada/vimnotes GitHub Wiki
Pracical Vim Tip 38.
Vim buffer FAQ Vim 101: Set Hidden
Open more than one file.
$ vim *.txt
:ls
# Edit one file and move to another file without saving
:bnext!
:ls
In #h + "a.txt", # means alternative, h means hidden and + means modified. %a means active and current file.
Options for hidden buffers on quit.
:w[rite] # Write the contents of the buffer to disk
:e[dit]! # REad the file from disk back into the buffer (that is, revert changes)
:qa[ll]! # Cose all windows, discarding changes without warning
:wa[ll] # Write all modified buffers to disk
- Under default settings, making changes and then opening a new file will display E37: No write since last change (add ! to override)
- Typing :set hidden will change this behaviour
- With :set hidden, opening a new file when the current buffer has unsaved changes causes files to be hidden instead of closed
- The unsaved changes can still be accessed by typing :ls and then :b[N], where [N] is the number of a buffer