vim插件之MiniBufExplorer

来源:互联网 发布:linux 如何查看nat 编辑:程序博客网 时间:2024/06/05 16:53

当只编辑一个buffer的时候MiniBufExplorer不起作用, 当打开第二个buffer的时候, MiniBufExplorer窗口就自动弹出来了, 见下图:


 
上面最左侧的窗口就是MiniBufExplorer窗口, 其中列出了当前所有已经打开的buffer, 当你把光标置于这个窗口时, 有下面几个快捷键可以用:
 
<Tab>   向前循环切换到每个buffer名上
<S-Tab> 向后循环切换到每个buffer名上
<Enter> 在打开光标所在的buffer
d       删除光标所在的buffer


以下的两个功能需要在~/.vimrc中增加:
let g:miniBufExplMapCTabSwitchBufs = 1
 
<C-Tab> 向前循环切换到每个buffer上,并在当前窗口打开
<C-S-Tab> 向后循环切换到每个buffer上,并在当前窗口打开;  
注:MiniBufExplore默认是这两个快捷键,可是在ubuntu10.04中不能使用,原因可能是bash中已经定义了ctrl+tab快捷键。所以我们可以更换此快捷键在~/.vim/plugin/minibufexpl.vim中找到: 
noremap <C-TAB>   :call <SID>CycleBuffer(1)<CR>:<BS>
noremap <C-S-TAB> :call <SID>CycleBuffer(0)<CR>:<BS>
重新定义成自己的map即可。

在~/.vimrc中设置:
let g:miniBufExplMapWindowNavVim = 1
则可以用<C-h,j,k,l>切换到上下左右的窗口中去。
在~/.vimrc中设置:
let g:miniBufExplMapWindowNavArrows = 1
是用<C-箭头键>切换到上下左右窗口中去

以下是MiniBufExplorer的几个命令: 
                :MiniBufExplorer    " Open and/or goto Explorer
                :CMiniBufExplorer   " Close the Explorer if it's open
                :UMiniBufExplorer   " Update Explorer without naviting
                :TMiniBufExplorer   " Toggle the Explorer window open and closed
 
如果在.vimrc中配置了mapleader,如
let mapleader = ","       "Set mapleader
 就可以在normal模式下用,mbc代替 :CMiniBufExplorer命令
其他命令为:
 
                :MiniBufExplorer      ,mbe
                :CMiniBufExplorer   ,mbc
                :UMiniBufExplorer   ,mbu
                :TMiniBufExplorer   ,mbt

相关设置:

  1. """"""""""""""""""""""""""""""  
  2. " miniBufexplorer Config  
  3. """"""""""""""""""""""""""""""  
  4. let g:miniBufExplMapWindowNavArrows = 1  
  5. let g:miniBufExplMapWindowNavVim = 1  
  6. let g:miniBufExplMapCTabSwitchWindows = 1  
  7. "let g:miniBufExplMapCTabSwitchBufs = 1   
  8. let g:miniBufExplModSelTarget = 1  
  9.   
  10. "解决FileExplorer窗口变小问题  
  11. let g:miniBufExplForceSyntaxEnable = 1  
  12. let g:miniBufExplorerMoreThanOne=2

在命令模式下:
:bn   打开当前buffer的下一个buffer
:bp   打开当前buffer的前一个buffer
:b"num"   打开指定的buffer,"num"指的是buffer开始的那个数字,比如上图,我想打开list_audit.erb,输入:b7就ok了


原创粉丝点击