Vim: Close All Buffers But This One

前端 未结 13 2364
别那么骄傲
别那么骄傲 2020-12-22 15:04

How can I close all buffers in Vim except the one I am currently editing?

13条回答
  •  半阙折子戏
    2020-12-22 15:49

    Building on juananruiz's answer.

    Make a small change in the buffer you want to keep, then

    :1,1000bd

    The command bd (buffer delete) will not delete any buffers with unsaved changes. This way you can keep the current (changed) file in the buffer list.

    Edit: Please notice that this will also delete your NERDTreeBuffer. You can get it back with :NERDTree

提交回复
热议问题