原文章: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