How to close buffer without closing the window?
Posted
by
progo
on Super User
See other posts from Super User
or by progo
Published on 2011-05-27T06:34:52Z
Indexed on
2012/08/30
21:41 UTC
Read the original article
Hit count: 209
vim
I usually open a few windows and keep some buffers open. Since my MO in buffer exploring is to use quick shortcuts to :bn
and :bp
, I want to close unneeded buffers from distracting my buffer surfing.
But the pain is, issuing :bd
and :bw
results in closing the window as well, in case I have multiple ones open. How do I close (delete) a buffer and leave the windows intact?
Solution inspired by @peth's answer
:command! BW :bn|:bd#
It is simple. Doesn't work well with only one buffer open (I get different behaviour depending on the way I open the files) but it isn't a big issue. :)
© Super User or respective owner