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, required
filetype off "required" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin '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 L9
Plugin 'user/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype 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…