Thinking of buffers in vim as tabs when using Textmate just made so much sense. So much sense that I wanted to write down the basics for me to come back to. Here are some few tips on how to use them to work efficient in VIM.
I think of buffers as references to the files you are working with currently. Try visualizing opening a file in a Textmate project. It becomes a tab and when opening another file, that too becomes another tab. So for me buffers in VIM is like tabs in Textmate, but not as visible or noisy.
- :ls - list all buffers
- :b [tab] - display all buffers
- :b my[tab] - display buffers whos filename starts with ´my´
Navigate between buffers
- :e#5 - go to buffer 5
- :b5 - go to buffer 5
- :b# - Switch between two buffers
If you want to delete a buffer in vim (like closing a tab in TextMate eg):
- :bdelete [buffernumber or filename]
- :bd - a shorter version
Next I´ll try to figure out how bookmarks works.