Ⅰ. 插件描述
A 'jump to previous buffer' command that behaves as you would expectⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'leonb/vim-previous-buffer'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'leonb/vim-previous-buffer'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'leonb/vim-previous-buffer'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/leonb/vim-previous-buffer
Ⅳ. 文档说明
# A 'jump to previous buffer' command that behaves as you would expect
This plugin adds a command to easily jump back to a previous buffer. It's better
than the built in :bn or CTRL-6 because it ignores :nobuflisted buffers so
you don't jump back to Unite's buffers,
Netrw buffers et cetera. Additionaly you can also provide a regex to ignore
buffers by name. The previous buffer is getting tracked on a per window basis
so even in the case of a multi-window setup you jump back to the right place.
Installation
I recommend using [Tim Pope's pathogen
plugin](https://github.com/tpope/vim-pathogen), [Shougo's NeoBundle
plugin](https://github.com/Shougo/neobundle.vim) or [Gmarik's Vundle
plugin](https://github.com/gmarik/Vundle.vim) to install this.
Usage
The plugin provides a :PreviousBuffer command but it would be a lot easier to
configure a mapping for it. I use this:
nmap <leader>bn :PreviousBuffer<CR>Configuration
You can configure the plugin to ignore additional buffers (that have buflisted
set) by setting the variable g:previous_buffer_ignore_pattern. The variable
string is treated as a regex when it is matched against the buffer name.bufname() is used for the match.
let g:previous_buffer_ignore_pattern = 'test_dir'The default value of g:previous_buffer_ignore_pattern = '' so by default onlynobuflisted buffers are ignored.
License
Same terms as Vim itself (see license)