Buffers
Files in memory, navigated with :ls and :b.
Vim loads each file into a buffer.:lslists all buffers.:bswitches to one by name or number.:bn/:bpstep through them.:bdunloads a buffer.
Every file you open in Vim becomes a buffer โ an in-memory copy. You may have ten buffers loaded but only one window showing one of them. Navigating buffers, not windows, is how you move between files.
| Key | Note |
|---|---|
| : | |
| l | |
| s | |
| Enter |
| Key | Note |
|---|---|
| : | |
| b | |
| {name} | |
| Enter |
| Key | Note |
|---|---|
| : | |
| b | |
| n | |
| Enter |
| Key | Note |
|---|---|
| : | |
| b | |
| p | |
| Enter |
| Key | Note |
|---|---|
| : | |
| b | |
| d | |
| Enter |
| Key | Note |
|---|---|
| {key:Ctrl-^} |
Worked example โ :ls and :b
Edit many files in one Vim session.
[missing screenshot windows.buffers/frame_01.color.svg โ run python content/render_screenshots.py]
[missing screenshot windows.buffers/frame_02.color.svg โ run python content/render_screenshots.py]
[missing screenshot windows.buffers/frame_03.color.svg โ run python content/render_screenshots.py]
Watch
See also: Creating Splits, Tabs, Buffer vs Window vs Tab