Vim:关闭所有缓冲区但这个缓冲区
问题描述:
如何关闭 Vim 中除当前正在编辑的缓冲区之外的所有缓冲区?
How can I close all buffers in Vim except the one I am currently editing?
答
你可以从 vim.org 使用这个脚本:
You could use this script from vim.org:
http://www.vim.org/scripts/script.php?script_id=1071
只要把它放到你的 .vim/plugin
目录,然后使用 :BufOnly
命令关闭所有缓冲区,但活动缓冲区除外.你也可以在你的 .vimrc
中将它映射到你喜欢的其他地方.
Just put it to your .vim/plugin
directory and then use :BufOnly
command to close all buffers but the active one. You could also map it elsewhere you like in your .vimrc
.
Github 上的源代码(通过 vim-scripts 镜像):https://github.com/vim-scripts/BufOnly.vim/blob/master/plugin/BufOnly.vim
Source on Github (via vim-scripts mirror): https://github.com/vim-scripts/BufOnly.vim/blob/master/plugin/BufOnly.vim