vim补全插件YouCompleteMe安装

原文章:http://blog.csdn.net/linuxzbq/article/details/15505395

原作者:zbqyexingkong


安装ycm需要Vim 7.3.584+的支持, 并且开启 +python , 可以通过:version查看升级Vim需要先卸载原有的Vim.

升级Vim  (参考:http://www.cnblogs.com/scue/p/3234102.html

    ~$: sudo apt-get install -y hgsvn libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev ruby-dev mercurial cscope exuberant-ctags  
    ~$: cd ~  
    ~$: hg clone https://code.google.com/p/vim/   #如果没装hg,就自行安装.  
    ~$: cd vim  
    ~$: ./configure --with-features=huge \  
                --enable-rubyinterp \  
                --enable-pythoninterp \  
                --with-python-config-dir=/usr/lib/python2.7-config/config \  
                --enable-perlinterp \  
                --enable-gui=gtk2 --enable-cscope --prefix=/usr  
      
    ~$: make VIMRUNTIMEDIR=/usr/share/vim/vim74  
    ~$: sudo make install     
    ~$: sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1  
    ~$: sudo update-alternatives --set editor /usr/bin/vim  
    ~$: sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1  
    ~$: sudo update-alternatives --set vi /usr/bin/vim  

编译Clang3_3

    ~$: sudo apt-get install -y g++ subversion cmake  
    ~$: cd ~  
    ~$: mkdir Clang && cd Clang  
    ~$: svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm  
    ~$: cd llvm/tools  
    ~$: svn co http://llvm.org/svn/llvm-project/cfe/trunk clang  
    ~$: cd ../../  
    ~$: mkdir build  
    ~$: cd build  
    ~$: ../llvm/configure --prefix=/usr/clang_3_3 --enable-optimized --enable-targets=host  
    ~$: make -j 4  
    ~$: sudo make install  
      
    export PATH=/usr/clang_3_3/bin:$PATH     #这一句最好写到~/.bashrc内  

安装YouCompleteMe

    ~$: git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle  
      
    ~$: vim ~/.vimrc  
      
     #复制下面的代码  
      
    """"""""""""""""""""""""""""""  
    " Vunble  
    """"""""""""""""""""""""""""""  
    filetype off " required!  
    set rtp+=~/.vim/bundle/vundle/  
    call vundle#rc()  
      
    " let Vundle manage Vundle  
    Bundle 'gmarik/vundle'  
      
    " vim-scripts repos  
    Bundle 'Valloric/YouCompleteMe'  
      
    filetype plugin indent on "   
      
    ~$: vim BundleInstall +qall   

编译YouCompleteMe

    ~$: cd ~  
    ~$: mkdir ycm_build  
    ~$: cd ycm_build  
    ~$: cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp  
    ~$: cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=/usr/clang_3_3/ . ~/.vim/bundle/YouCompleteMe/cpp  
    ~$: make ycm_core  
    ~$: cp /usr/clang_3_3/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python/libclang.so #这一步是为了使用新的libcang.so  
      
    ~$: cd ~/.vim/bundle/YouCompleteMe  
    .vim/bunble/YouCompleteMe$: ./install.sh --clang-completer  





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值