Step 2 of 6

11. Buffers

Listing your open buffers

It’s easy to lose track of which buffers are loaded. So, Vim provides a command for listing them: :ls.

There are three other files alongside the editor’s exercise.txt: a.txt, b.txt, and c.txt.

Work through the checklist below: list your buffers while only exercise.txt is loaded, open each of the other files with :e, then list the buffers again to see everything you’ve collected. After showing the list, Vim waits for you to press Enter before returning you to your file.

  1. List your open buffers Only exercise.txt is loaded so far — type :ls and hit Enter, then hit Enter again to leave the list.
  2. Open a.txt The statusline will show the new name — type :e a.txt and hit Enter.
  3. Open b.txt Same again — type :e b.txt and hit Enter.
  4. Open c.txt One more — type :e c.txt and hit Enter.
  5. List the buffers again All four buffers show up this time — type :ls and hit Enter, then hit Enter again to dismiss the list.
List your open buffers Only exercise.txt is loaded so far — type :ls and hit Enter, then hit Enter again to leave the list.

Next: Open a.txt

Loading editor…