微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐