Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I close all buffers but one in vim? I'm looking for an :only command, but for buffers. I've had trouble finding this using :help and :helpgrep, does anyone know if this exists? I know you can close multiple buffers with :bd some# other# etc.., but that's a bit slow

share|improve this question
up vote 2 down vote accepted

There is a plugin that will do what you want:

share|improve this answer
hmm, that looks alright, but doesn't seem to load with vim-unbundle, so I need to :source it manually. Do you know why? – Josh Jun 7 '12 at 15:02
I've never used unbundle so I'm not sure. But from what I read in the link you provided, unbundle looks for bundle directories. BufOnly is just a single .vim file. So :source it or just download it to your plugins directory. – embedded.kyle Jun 7 '12 at 17:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.