环境:centos7 + python2.7
坑:centos7中自带的vim 版本是7.4.160,安装完成YMC后报:YouCompleteMe unavailable: requires Vim 7.4.1578+.
解决方法:升级VIM 到8版本后解决
vimrc配置文件:
set nocompatible " be iMproved, required
set backspace=2
syntax on " 语法高亮
filetype off " required
filetype indent on " 根据文件类型缩进
filetype plugin on " for vim Makefile
set nu " 显示行号
" 缩进设置
set autoindent " 自动缩进
set cindent " C风格缩进
set smartindent " 智能缩进
" 普通文件Tab设置
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" 括号匹配
set showmatch
set matchtime=1 " 匹配高亮时间(单位是十分之一秒)
set completeopt=longest,menu "让Vim的补全菜单行为与一般IDE一致(参考VimTip1228)
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'Chiel92/vim-autoformat'
call vundle#end() " required
filetype plugin indent on " required
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
let g:ycm_complete_in_strings = 0 " 设置YCM不在字符串内补全
let g:ycm_confirm_extra_conf = 0
let g:ycm_seed_identifiers_with_syntax = 1
参考文章:
http://blog.csdn.net/nzyalj/article/details/75331822