- With many GUI apps, tabs are used for separate files.
- With vim, tabs are used for separate workspaces.
- Each open file has its own buffer.
- Different tabs can show the same buffer.
set hiddenallows you to load a new file with:ewithout unsaved changes- Importantly, tabs are not file proxies like in most editors. Having 100 open buffers is no problem for vim. But having 100 tabs is unmanageable.
- Then use windows when you want to see the contents of two files simultaneously, or want to see two different parts of a large file simultaneously. Windows are not file proxies either.
Buffer commands
:ls | list buffers |
:bN | switch to buffer N |
:b abc | switch to buffer with abc in the name provided this is unique |
:bd N | close buffer N |
:bd abc | close buffer uniquely identified by abc |