2

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

2

There is a plugin that will do what you want:

http://www.vim.org/scripts/script.php?script_id=1071

  • 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
  • 1
    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
1

Try out :%bd|e# which says "delete all buffers, then open the last one for editing".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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