!!!基于Ubuntu12.04!!!
Ubuntu 14.04还没有测试,不过在12.04编译过后可以在14.04及其以后的版本中运行。
vim的版本必须要7.4以上的才行啊
日和安装vim 7.4
添加如下软件源:
$ sudo add-apt-repository ppa:fcwu-tw/ppa
$ sudo apt-get update
$ sudo apt-get install vim
然后安装
首先安装vundle
如果没有git,要安装git命令: git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
然后把如下信息添加到 ~/.vimrc,如果没有那么新建一个
命令(假设没有):
touch ~/.vimrc
vim .vimrc
添加的信息:
set nocompatible " be iMproved
set nu
set noswapfile
syntax on
set backspace=2
set tabstop=4
set shiftwidth=4
set completeopt=menu
:colorscheme ron
set cindent
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Valloric/YouCompleteMe'
Bundle 'scrooloose/syntastic'
Bundle 'jiangmiao/auto-pairs'
""""""""""syntastic""""""""""""
let g:syntastic_check_on_open = 1
let g:syntastic_cpp_include_dirs = ['/usr/include/']
let g:syntastic_cpp_remove_include_errors = 1
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_compiler = 'clang++'
"set error or warning signs
let g:syntastic_error_symbol = 'x'
let g:syntastic_warning_symbol = '!'
"whether to show balloons
let g:syntastic_enable_balloons = 1
""""""""""""YCM""""""""""""""""""""
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_confirm_extra_conf = 0
filetype plugin indent on
随便打开一个vim窗口
输入:
:BundleInstall
等待自动安装
等待安装完成,然后就是开始ycm的编译和安装
首先进行:
sudo apt-get install python-dev
sudo apt-get install cmake
sudo apt-get install build-essential
下载clang+llvm-ubuntu-12.04.2-amd64.tar.gz
地址:点击即可下载
然后运行如下命令:
cd ~
mkdir ycm_build
cd ycm_build
在ycm_build下面运行:
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/clang_llvm . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
现在运行:
make ycm_support_libs