Original URL: http://m.blog.csdn.net/blog/unhappypeople/19160243
Used to be CTAGS+OMNICOMPLETE+ACP way, this time change to clang self-analytic way to try A
Ever since I knew Vundle, my mother never had to worry about me getting into trouble with the underground plugin.
0. Install the necessary components
sudo apt-get install 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 Checkinstall
1. Upgrade Vim to 7.4
1) Compiling yourself
I) Uninstall the original VIM
sudo apt-get remove vim vim-tiny vim-common vim-runtime gvim Vim-gui-common
Download the latest VIM source code
HG clone Https://vim.googlecode.com/hg/vimcd vim./configure--with-features=huge --enable-rubyinterp=yes - -enable-pythoninterp=yes --enable-python3interp=yes --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2--enable-cscope--prefix=/usrmake vimruntimedir=/usr/share/vim/vim74make Install
2) manually add PPA (Personal package Archives)
sudo add-apt-repository ppa:nmi/vim-snapshots
sudo apt-get update
sudo apt-get install vim
2. Installing LLVM & Clang
Download compiled binaries to http://llvm.org/releases/download.html#3.3
Http://llvm.org/releases/3.3/clang+llvm-3.3-amd64-Ubuntu-12.04.2.tar.gz
Unzip to/
TAR-ZXF CLANG3.3-AMD64-UBUNTU-12.04.2.TAR.GZCD Clang+llvm-3.3-amd64-ubuntu-12.04.2/cp-r */
If you enter clang at the command line, output clang:error:no input files, stating that the installation was successful
3. Download Vundle
git clone https://github.com/ Gmarik/vundle.git ~/.vim/bundle/vundle
Vundle allows vim to automatically download plugins from places such as GitHub without having to manually download
changes on each vim.org. VIMRC
set nocompatible "be improvedset nuset noswapfilesyntax onset Backspace=2set Tabstop=2set shiftwidth=2set completeopt=menu:colorscheme ronset cindentset rtp+=~/.vim/bundle/vundle/call VUNDLE#RC Bundle ' Gmarik/vundle ' bundle ' valloric/youcompleteme ' bundle ' scrooloose/syntastic ' "" "" "" "" "" "" "" "" "" "" "" "Let G:syntastic_check_on_open = 1let g:syntastic_cpp_include_dirs = ['/usr/include/']let g:syntastic_cpp_remove_ Include_errors = 1let G:syntastic_cpp_check_header = 1let G:syntastic_cpp_compiler = ' clang++ ' "set error or warning SIGNSL ET g:syntastic_error_symbol = ' x ' let G:syntastic_warning_symbol = '! ' " Whether to show balloonslet g:syntastic_enable_balloons = 1 "," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Let G:ycm_global_ycm_ extra_conf = ' ~/.vim/bundle/youcompleteme/cpp/ycm/.ycm_extra_conf.py ' let G:ycm_collect_identifiers_from_tags_ Files = 1let G:ycm_seed_identifiers_with_syntax = 1let g:ycm_confirm_extra_conf = 0
Then open vim
Enter in command mode
: Bundleinstall, you will find that Vim automatically starts to download the plugin.
Note:
Youcompleteme plugin to download for a long time, please be a little:-)
4. Compiling Ycm_core & Ycm_support_libs
CD ~mkdir ~/YCM_BUILDCD ~/ycm_buildcmake-g "Unix makefiles" ~/.vim/bundle/youcompleteme/cpp-dexternal_libclang_ Path=/lib/libclang.somake Ycm_coremake Ycm_support_libs
Note here that the-dexternal_libclang_path parameter is used to specify the location of the libclang.so
5. Configuration. ycm_extra_conf.py
~/.vim/bundle/youcompleteme/cpp/ycm/.ycm_extra_conf.py
At the end of the flags of this file is added:
'-isystem ',
'/usr/include ',
'-isystem ',
'/usr/include/c++/'
6. Attached:
"Go" Ubuntu12.04 install Youcompleteme plug-in