October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 39 | 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 quitting Vim.
Run these commands in the shell to launch Vim:
| => | $ cd code/files |
| => | $ ls |
| <= | a.txt b.txt |
| => | $ vim *.txt |
| <= | 2 files to edit |
Let’s make a change to a.txt. We’ll just press Go to append a blank line at the end of the buffer. Without saving the changes, let’s examine the buffer list:
| => | :ls |
| <= | 1 %a + "a.txt" line 1 |
| | 2 "b.txt" line 0 |
The buffer representing a.txt is annotated with a + sign, which indicates that it has been modified. If we were to save the file now, the contents ...