Linux下 Vundle安装和使用 Vim实现代码跳转
安装依赖
Vundle是vim的一个插件管理器, 同时它本身也是vim的一个插件,可以搜索、安装、更新、清理插件。Vundle的安装需要git和curl的支持。如果没有上述两个套件可以先下载。yum install crul
yum install git
安装Vundle
修改~/.vimrc
文件,如果你不是root用户,那么请修改对应用户目录下的.vimrc
文件,比如用户名是bar,请修改/home/bar/.vimrc
文件,没有.vimrc
文件就创建一个。
将以下文本追加到.vimrc
文件中
set nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.htmlPlugin 'L9'" Git plugin not hosted on GitHubPlugin 'git://git.wincent.com/command-t.git'" git repos on your local machine (i.e. when working on your own plugin)Plugin 'file:///home/gmarik/path/to/plugin'" The sparkup vim script is in a subdirectory of this repo called vim." Pass the path to set the runtimepath properly.Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}" Avoid a name conflict with L9Plugin 'user/L9', {'name': 'newL9'}" All of your Plugins must be added before the following linecall vundle#end() " requiredfiletype plugin indent on " required" To ignore plugin indent changes, instead use:"filetype plugin on"" Brief help" :PluginList - list configured plugins" :PluginInstall(!) - install (update) plugins" :PluginSearch(!) foo - search (or refresh cache first) for foo" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins"" see :h vundle for more details or wiki for FAQ" Put your non-Plugin stuff after this line
用Vundle安装插件,两种方式
1.打开vim然后输入
:PluginInstall
Vundle会自动安装配置文件里 call vundle#begin()
和call vundle#end()
之间记录的插件,安装完成后会显示done
。过程可能有点费时间。
2.从命令行安装
在命令行中输入:vim +PluginInstall +qall
,等待一段时间知道显示done
使用代码跳转功能
用vim打开源码文件,将光标放在要查看的函数上,Ctrl+]
可以跳转,Ctrl+t
可以返回,如果有多个跳转选项,按数字键选择跳转到哪一个。
vundle其他命令,摘自Vundle官网
Brief help:PluginList - lists configured plugins:PluginInstall - installs plugins; append `!` to update or just :PluginUpdate:PluginSearch foo - searches for foo; append `!` to refresh local cache:PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
Vundle官网: https://github.com/VundleVim/...
引用:https://www.jianshu.com/p/183...