Vim uses buffers as containers for work. Understanding buffers completely is an acquired skill; there are many commands for manipulating and navigating them. However, it is worthwhile to familiarize yourself with some of the buffer basics and understand how and why they exist throughout a Vim session.
A good starting point is to open up a few windows editing
different files. For example, start Vim by opening
Then, within the session, issue
file2 and then
You should now have three open files in three separate Vim windows.
Now use the commands
:buffers to list the buffers. You should see three lines, each numbered and including
the filenames, along with additional information. These are Vim’s
buffers for this session. There is one buffer for each file and each
buffer has a unique, nonchanging associated number. In this example,
file1 is in buffer 1,
file2 is in buffer 2,
Additional information on each buffer can be displayed if you
append an exclamation point (
!) after any of the commands.
To the right of each buffer number are status flags. These flags describe the buffers as shown in Table 11-6.
Unlisted buffer. This buffer is not listed unless you use the