Linux下-Vundle安装和使用-Vim实现代码跳转

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…

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理