bufkill.vim


Ⅰ. 插件描述

Git repo for http://www.vim.org/scripts/script.php?script_id=1147

Ⅱ. 基本信息

创建日期:  2004-12-01
使用用户:  519
Github星:  215
插件作者:  John Orr

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# vim-bufkill

In Vim, trying to unload, delete or wipe a buffer without closing the window or split? You'll like this:

With bufkill:

With bufkill

Without bufkill (standard Vim behaviour):

Without bufkill

The inspiration for this script came from:

  • My own frustration with vim's lack of this functionality
  • The description of the emacs kill-buffer command in tip #622 (this script basically duplicates this command I believe, not sure about the undo functionality)
  • Comments by Keith Roberts when the issue was raised in the vim@vim.org mailing list.

Note: This is the official Git repo which replaces http://www.vim.org/scripts/script.php?script_id=1147

Installation

This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:

  • Pathogen

    • git clone https://github.com/qpkorr/vim-bufkill ~/.vim/bundle/vim-bufkill
  • Vundle:

    • Plugin 'qpkorr/vim-bufkill'

Usage

Unloading/Deleting/Wiping

When you wish to unload a file from the buffer and keep the window/split intact:

:BUN

When you wish to delete a file from the buffer and keep the window/split intact:

:BD

When you wish to wipe a file from the buffer and keep the window/split intact:

:BW

Notice how the key mappings are the uppercase version of the :bun :bd :bw Vim commands? Easy!

Moving through buffers

To move backwards through recently accessed buffers:

:BB

and to move forwards:

:BF

To move to an alternate buffer and keep the cursor in the same column, use:

:BA

Also...

You can also override Ctrl-^ (Vim's default for swapping between alternate buffers) via g:BufKillOverrideCtrlCaret in your /.vimrc file.

You can overide the default mappings within your /.vimrc file like so:

map <C-c> :BD<cr>

resulting in being able to delete a file from the buffer via vim-bufkill with CTRL + c

Contributions

Contributions and pull requests are welcome.

A big thanks to Oli Morris for his excellent rewrite of this README file, and creating the animated gifs.

添加新评论