下载Vundle到制定目录
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Vundle的配置
参考:https://github.com/VundleVim/Vundle.vim
- 第一步
将vundle下载到制定目录:git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
我们将其下载到了我们的/usr/home目录下。 - 编辑配置 Plugins
打开 .vimrc文件,将要下载的插件写入 call vundle#begin()和call vundle#end()之间 - 运行vim,在命令模式下运行命令:PluginInstall或者通过命令行直接安装:vim +PluginInstall +qall来安装配置好的插件。
自己的配置:
set encoding=utf-8
" Vundle
set nocompatible " be iMproved, required
filetype on
set rtp+=~/.vim/bundle/Vundle.vim
" vundle 管理的插件列表必须位于 vundle#begin() 和 vundle#end() 之间
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
Plugin 'vim-scripts/phd'
Plugin 'Lokaltog/vim-powerline'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'derekwyatt/vim-fswitch'
Plugin 'kshenoy/vim-signature'
Plugin 'vim-scripts/BOOKMARKS--Mark-and-Highlight-Full-Lines'
Plugin 'majutsushi/tagbar'
Plugin 'vim-scripts/indexer.tar.gz'
Plugin 'vim-scripts/DfrankUtil'
Plugin 'vim-scripts/vimprj'
Plugin 'dyng/ctrlsf.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-scripts/DrawIt'
Plugin 'SirVer/ultisnips'
Plugin 'Valloric/YouCompleteMe'
Plugin 'derekwyatt/vim-protodef'
Plugin 'scrooloose/nerdtree'
Plugin 'fholgado/minibufexpl.vim'
Plugin 'gcmt/wildfire.vim'
Plugin 'sjl/gundo.vim'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'suan/vim-instant-markdown'
Plugin 'lilydjwg/fcitx.vim'
Plugin 'The-NERD-tree'
" 插件列表结束
call vundle#end()
filetype plugin indent on
"设置目录树的配置 NERDTree"
autocmd vimenter * NERDTree
"config show or not show Tree"
map<F3>:NERDTreeMirror<CR>
map<F3>:NERDTreeToggle<CR>
let NERDTreeWinSize=25
let g:NERDTreeDirArrows = 1
set nu "设置行号,取消后面加!
syntax on "设置高亮格式
set shiftwidth=4"shift键相当于几个空格
"YouCompleteMe的配置信息"
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
set runtimepath+=~/.vim/bundle/YouCompleteMe
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
以下是一些安装插件的例子。可以参考一下。
安装YouCompleteMe
YouCompletMe是用来在编写程序的时候,使得有些代码能够自动补全的功能。
- 在~/.vim/vimrc中添加
Plugin ‘Valloric/YouCompleteMe’ - 运行vim,并在命令行模式中运行:
:PluginInstall - 下载完成之后,需要手动编译后才能使用
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
如果不需要c-famliy的补全,可以去掉–clang-completer。就这样,安装结束。打开vim,如果没有提示YCM未编译,则说明安装已经成功了。 - 配置YouCompleteMe
不同于很多vim插件,YCM首先需要编译,另外还需要配置。在vim启动后,YCM会找寻当前路径以及上层路径的.ycm_extra_conf.py,需要将文件拷贝到~/.vim/bundle/YouCompleteMe
目录中。
配置.ycm_extra_conf.py,我把flags增加对c++相关目录的配置,我把针对OS X的配置删除了。
可以对其配置的话去上网查找一下。
然后在vimrc加入该目录: - 指定.ycm_extra_conf.py的目录
let g:ycm_global_ycm_extra_conf = ~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py
- 配置ctags 的寻找路径
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 1
如果为1的话,会总是提示是否加载.ycm_extra_conf.py文件
let g:ycm_confirm_extra_conf = 0
安装Ctags
ctags的功能是可以在源码里对定义的函数和宏,以及变量进行定位,以便查看原始的定义。在程序中对函数,宏进行跳转。