If you want to work with multiple files at the same time and if you are new to vim you might not know what buffers are about. They’re really useful. Here is a short blog on how to use them.
- When you start vim you can start with multiple file arguments in the first place. Then all of them are opened together in different buffers.
- When you want to open another file as another buffer you can say,
- You can say
:lsto list the active buffers. They are ordered and numbered.
- You can use the list number of the buffer to switch to that buffer, by saying
:b #. Replace # with the number.
- You can also switch using the file name by saying,
:b filename/path. Partially filling the name of the file and pressing tab also works.
- To delete a buffer say
:bd #. As previously mentioned, replace # with the list number. You can also use the filename/path.
- Before you can switch from one buffer to another it needed to be saved by saying,
:w. Not sure if this can be changed in some global settings.