Vim 安装 YouCompleteMe 插件

在ubuntu 16.04上面安装YouCompleteMe插件

vim版本:8.0[需要python支持] cmake libclang3.9+ [需要自己去llvm官网下载预编译好的二进制文件,添加到PATH路径的文件夹下面]

1.使用Vundle来安装:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

在vimrc文件里面安装想要的插件:

set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'

call vundle#end()
filetype plugin indent on

打开vim,输入:PluginInstall [需要很长时间]

2. 安装:

sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
cd ~/.vim/bundle/YouCompeteme
./install.py --clang-completer

3.如果上一步安装失败的话,需要自己编译,具体点这里

4.把.ycm_extra_conf.py 复制到your/path/to/.ycm_extra_conf.py

5.几个重要的option[ycm配置]

  1. let g:ycm_global_ycm_extra_conf = ‘Your/path/to/.ycm_extra_conf.py ’
    指定ycm的配置文件。
  2. let g:ycm_seed_identifiers_with_syntax = 1
    自动根据语法收集关键词
  3. let g:ycm_add_preview_to_completeopt = 0
    关闭函数原型提示
  4. let g:ycm_show_diagnostics_ui = 0
    关闭错误提示
  5. let g:ycm_semantic_triggers = {}
    ycm默认需要按ctrl + space 来进行补全,可以在上面的花括号里面加入下面两行代码来直接进行补全[不需要按键]
let g:ycm_semantic_triggers =  {
\   'c,cpp,python,java,go,erlang,perl':['re!\w{2}'],
\   'cs,lua,javascript':['re!\w{2}'],
\}

猜你喜欢

转载自blog.csdn.net/nia305/article/details/79954974