Using vim file buffers
Vim has a feature called “file buffers” that works as follows : During a vim session, each time a file is opened, vim keeps an entry for the file in what could be called a “recently opened files” list. This entry is called buffer.
This buffer list can server as a file navigation tool that facilitates the editing of multiple files during the same vim session. When you need to work on a file that you previously opened, you can open the buffer list, locate your file by its name then use the associated buffer number to open it, all without leaving the vim session.
vim commands for file buffers
The basic commands for working with file buffers are listed in the table below :
| Command | Arguments | Description |
|---|---|---|
| :ls | lists the file buffers available in the current vim session | |
| :bN | N: buffer number | Given a buffer number N, this command opens the file associated to the buffer in the current window |
| :sbN | N: buffer number | Given a buffer number N, this command opens the file associated to the buffer in a new window |
| :bp | Open previous buffer in list | |
| :bn | Open next buffer in list | |
| :on | Closes all windows except the current one | |
| Labels: coding |
|

Comment