安装vim的YouCompleteMe插件

1. 安装vim7.4,从官网下载vim7.4.tar.gz(因为YouCompleteMe只支持vim7.3.584以上版本)

         ./configure  --enable-multibyte --enable-pythoninterp=yes --enable-python3interp=yes

        make & make install

        export PATH=/usr/local/bin:$PATH


2. 安装clang_3_3, 建议直接在官网下载编译好的版本

        export PATH=/usr/clang_3_3/bin:$PATH


3. 编译和安装、使用YouCompleteMe(https://github.com/Valloric/YouCompleteMe)

 a. 安装管理插件的VIM插件(vunble)

          git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

 b. 下载YouCompleteMe至本地

          git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe

 c. 继续更新第三方文件

        git submodule update --init --recursive


 4. vim ~/.vimrc,往里边添加以下这段内容(示例):

filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
call vundle#end()
filetype plugin indent on

5. 继续以下操作

cd ~
mkdir ycm_build 
cd ycm_build 
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp 
或者通过指定clang_3_3的方式:cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=/root/clang_3_3/ . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
make ycm_core
make

     配置补全,在vimrc中加入

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" YouCompleteMe
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'

     并在.ycm_extra_conf.py'添加如下代码,以支持STL的成员函数显示。

'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/bin/../lib/c++/v1',
'-isystem',
'.'


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值