开发者

How to delete a buffer in Vim without closing the window?

开发者 https://www.devze.com 2023-01-30 08:03 出处:网络
I usually type :bd to开发者_如何学运维 remove the buffer, however, it results in undesirable side-effect of the window being closed which I do NOT want.I usually use :bn (next buffer) followed by :bd#

I usually type :bd to开发者_如何学运维 remove the buffer, however, it results in undesirable side-effect of the window being closed which I do NOT want.


I usually use :bn (next buffer) followed by :bd# (delete alternate buffer). You could create a mapping or command for this, of course.


nmap <leader>d :bprevious<CR>:bdelete #<CR>

Works as it should until one buffer is open in several windows. Good enough unless you want to use the bigger scripts out there.


I'm not sure if icecrime's bufclose plugin link is based on the same thing, but the Vim Tips Wiki shows a couple of different approaches via a script. Check them out.


Try kwbdi(Keep Window on Buffer Delete) plugin. Worked well for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号