Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


<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


Oh wow, that's an excellent find. That immediately made playing around with buffers much easier.


Indeed! I was using BufferExplorer and accidentally 'discovered' <leader>b. 30 minutes later, BufferExplorer was dead :)


BufferExplorer 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: