1 安装git ,按照这篇文章安装
http://www.cnblogs.com/or2-/p/4350252.html
2 安装编译需要的各种包
sudo apt-get install build-essential cmake sudo apt-get install clang sudo apt-get install python-dev
3 安装vim ,使用国内阿狸云仓库的vim就可以
sudo apt-get install vim 也可以安装上vim-gnome sudo apt-get install vim-gnome
4 在你的用户家目录里新建 .vimrc文件
例如
~ ls .vimrc
.vimrc
5 在.vimrc文件中加入vundle组件管理插件,
set nocompatible " be iMproved, required filetype off " required set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'gmarik/Vundle.vim' Plugin 'tpope/vim-fugitive' Plugin 'L9' Plugin 'git://git.wincent.com/command-t.git' Plugin 'Valloric/YouCompleteMe' Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} Plugin 'user/L9', {'name': 'newL9'} call vundle#end() " required filetype plugin indent on " required
6 保存退出
7 打开gvim 或者vim 试图模式执行PluginInstall,等待下载好YouCompleteMe
8 去下载目录
cd ~/.vim/bundle/YouCompleteMe ./install.sh --clang-completer //只是编译安装支持c/c++语法补全
9编译安装后,需要在.vimrc中添加配置,.ycm_extra_conf.py是一个隐藏文件
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' set completeopt=longest,menu autocmd InsertLeave * if pumvisible() == 0|pclose|endif let g:ycm_collect_identifiers_from_tags_files=1 let g:ycm_min_num_of_chars_for_completion=2 "禁止缓存匹配项,每次都重新生成匹配项 let g:ycm_cache_omnifunc=0 let g:ycm_seed_identifiers_with_syntax=1 let g:ycm_confirm_extra_conf = 0 "允许在字符串里补全(双引号) let g:ycm_complete_in_strings = 1 " 在注释输入中也能补全 let g:ycm_complete_in_comments = 1 "自动补全快捷键 let g:ycm_key_invoke_completion = '<S-Space>' "补全之后自动关闭preview let g:ycm_autoclose_preview_window_after_completion = 1 let g:ycm_key_list_select_completion = ['<Down>'] inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " YCM 补全菜单配色 highlight Pmenu ctermfg=2 ctermbg=3 guifg=SeaGreen guibg=blue highlight PmenuSel ctermfg=2 ctermbg=3 guifg=SeaGreen guibg=yellow