4 ms·
Surprise! You have been using buffers all this time. A "buffer" is just "a file in memory"; if you have 1 split on your screen, with a different file in each
by mcantor 15y ago
Surprise! You have been using buffers all this time. A "buffer" is just "a file in memory"; if you have 1 split on your screen, with a different file in each split, then you are viewing 2 buffers.
The two things which will probably give you the biggest bang for your buck are:
:ls
Which lists all buffers currently in memory, and:
:b
Which supports tab completion, allowing you to instantly jump to any file with just a few keystrokes. You'll also probably enjoy Ctrl + 6 / Ctrl + ^, which swaps between two buffers.
You'll need to do
:set hidden
before switching between buffers in a single window. Don't worry, though; if you try to quit without saving a modified buffer, or use :bd to delete a buffer without saving it, vim will yell at you.
- bsergean 15y ago:b also takes the buffer id. (reported by :ls). I sometimes write them down on a post-it when I have lots of files to memorize them ... :)
- yuvipanda 15y ago<leader>b is a good replacement for both :ls and :b if you're using Command-T (like grandparent is). I was surprised when I discovered that feature, since it isn't quite as advertised/popular as the file opening capabilities of Command-T
- Pewpewarrows 15y agoOh wow, that's an excellent find. That immediately made playing around with buffers much easier.
- yuvipanda 15y agoIndeed! I was using BufferExplorer and accidentally 'discovered' <leader>b. 30 minutes later, BufferExplorer was dead :)
- pyre 15y agoBufferExplorer is a good plugin to have around. <leader>be will give you a listing of all of your buffers and allow you to do things like hit 'd' to delete the buffer under the cursor.