vim-bbye


Ⅰ. 插件描述

Delete buffers and close files in Vim without closing your windows or messing up your layout. Like Bclose.vim, but rewritten and well maintained.

Ⅱ. 基本信息

创建日期:  2013-07-20
使用用户:  7
Github星:  0
插件作者:  Glenn Waters

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'gwww/vim-bbye'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'gwww/vim-bbye'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'gwww/vim-bbye'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/gwww/vim-bbye

Ⅳ. 文档说明

Bbye (Buffer Bye) for Vim

Bbye allows you to do delete buffers (close files) without closing your windows or messing up your layout.

Vim by default closes all windows that have the buffer (file) open when you do :bdelete. If you've just got your splits and columns perfectly tuned, having them messed up equals a punch in the face and that's no way to tango.

Bbye gives you a :Bdelete command that behaves like a well designed citizen:

  • Closes and removes the buffer.
  • Shows another file in that window.
  • Shows an empty file if you've got no other files open.
  • Does not leave useless [no file] buffers if you decide to edit another file in that window.
  • Works even if a file's open in multiple windows.
  • Works a-okay with various buffer explorers and tabbars.

Regain your throne as king of buffers!

Installing

The easiest and most modular way is to download Bbye to ~/.vim/bundle:

mkdir -p ~/.vim/bundle/bbye

Using Git:

git clone https://github.com/moll/vim-bbye.git ~/.vim/bundle/bbye

Using Wget:

wget https://github.com/moll/vim-bbye/archive/master.tar.gz -O- | tar -xf- --strip-components 1 -C ~/.vim/bundle/bbye

Then prepend that directory to Vim's &runtimepath (or use Pathogen):

set runtimepath^=~/.vim/bundle/bbye

Using

Instead of using :bdelete, use :Bdelete.
Fortunately autocomplete helps by sorting :Bdelete before its lowercase brother.

As it's likely you'll be using :Bdelete often, make a shortcut to \q, for example, to save time. Throw this to your vimrc:

:nnoremap <Leader>q :Bdelete<CR>

Closing all open buffers and files

Occasionally you'll want to close all open buffers and files while leaving your pristine window setup as is. That's easy. Just do:

:bufdo :Bdelete

Aliasing to :Bclose

If you've used any Bclose.vim scripts before and for some reason need the :Bclose command to exist, you may make an alias:

command! -bang -complete=buffer -nargs=? Bclose Bdelete<bang> <args>

License

Bbye is released under a Lesser GNU Affero General Public License, which in summary means:

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g bug-fixes) you've made to this program.

For more convoluted language, see the LICENSE file.

About

Andri Möll authored this in SublemacslipseMate++.
Monday Calendar supported the engineering work.
Inspired by Bclose.vim, but rewritten to be perfect.

If you find Bbye needs improving or you've got a question, please don't hesitate to email me anytime at andri@dot.ee or create an issue online.

添加新评论