d11wtq
d11wtq

Reputation: 35298

Close multiple vim buffers interactively?

After a while having a text editor open, especially after performing a fairly substantial refactor that touches a large number of files, you end up with a lot of buffers open.

In emacs I had become accustomed to using kill-some-buffers, which basically starts in interactive yes/no session, presenting each buffer's name and allowing you to press y or n to either keep or delete each buffer, until all buffers have been presented to you (or you cancel the command).

Is there a way to do the equivalent in vim? I can use a wildcard, but the filenames are all ruby files with different names (basically every file in my project). Easiest thing is for me to just close all buffers and start over, but that's not really the solution I'm looking for, just for my own future reference.

If I could open a split window with a list of all the buffers and "mark" each buffer I want to close in some way, then "commit" that decision, that would work too. Basically just something that doesn't require me to apply thought-provoking logic to the process of closing a bucket-load of buffers.

Upvotes: 3

Views: 379

Answers (1)

mliebelt
mliebelt

Reputation: 15525

I have found the plugin buffet which allows similar things:

  • Use :Bufferlist to open the list of buffers.
  • Move up and down with the usual keys (j, k).
  • Delete the buffer under cursor with d

I think that is similar enough to mark the buffer for deletion.

Upvotes: 3

Related Questions