vim + bufexplorer

[缓冲区浏览]


在开发过程中,经常会打开很多缓冲区,尤其是使用tag文件在不同函数间跳转时,会不知不觉打开很多文件。要知道自己当前打开了哪些缓冲区,可以使用vim的":ls"Ex命令查看。


开发过程中,又经常需要在不同文件间跳转。我习惯于使用"CTRL-^"来切换文件,这就需要知道文件所在的缓冲区编号。每次都使用":ls"来找缓冲区编号很麻烦,所以我使用BufExplorer插件来显示缓冲区的信息。


BufExplorer插件在此处下载:http://vim.sourceforge.net/scripts/script.php?script_id=42


下载后,把该文件在~/.vim/目录中解压缩,这会在你的~/.vim/plugin和~/.vim/doc目录中各放入一个文件:


plugin/ bufexplorer.vim - bufexplorer插件
doc/ bufexplorer.txt    - bufexplorer帮助文件 
注:windows用户需要把这个插件解压在你的$vim/vimfiles或$HOME/vimfiles目录。


使用下面的命令生成帮助标签(下面的操作在vim中进行):


:helptags ~/.vim/doc 
然后,就可以使用":help bufexplorer"命令查看BufExplorer的帮助文件了。


BufExplorer功能比较简单,这里就不做介绍了。我的vimrc里这样设置BufExplorer插件:


""""""""""""""""""""""""""""""
" BufExplorer
""""""""""""""""""""""""""""""
let g:bufExplorerDefaultHelp=0       " Do not show default help.
let g:bufExplorerShowRelativePath=1  " Show relative paths.
let g:bufExplorerSortBy='mru'        " Sort by most recently used.
let g:bufExplorerSplitRight=0        " Split left.
let g:bufExplorerSplitVertical=1     " Split vertically.
let g:bufExplorerSplitVertSize = 30  " Split width
let g:bufExplorerUseCurrentWindow=1  " Open in new window.
autocmd BufWinEnter \[Buf\ List\] setl nonumber 
BufExplorer已经映射了几个键绑定,例如,使用",bv"就可以打开一个垂直分割窗口显示当前的缓冲区。






description
With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: 


  '\be' (normal open)  or 
  '\bs' (force horizontal split open)  or 
  '\bv' (force vertical split open) 


Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use <Enter> or <Left-Mouse-Click> to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either <Shift-Enter> or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help.


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值