Install YouCompleteMe plugin on ubuntu 16.04
vim version: 8.0 [requires python support] cmake libclang3.9+ [you need to go to the llvm official website to download the precompiled binary file and add it to the folder of the PATH path]
1. Use Vundle to install:
git clone https://github.com/VundleVim/Vundle.vim.git ~ / .vim / bundle / Vundle.vim
Install the desired plugin in the vimrc file:
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
Open vim, enter: PluginInstall [takes a long time]
2. Install:
sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
cd ~/.vim/bundle/YouCompeteme
./install.py --clang-completer
3. If the installation fails in the previous step, you need to compile it yourself, click here for details
4. Copy .ycm_extra_conf.py to your/path/to/.ycm_extra_conf.py
5. Several important options [ycm configuration]
- let g:ycm_global_ycm_extra_conf = 'Your/path/to/.ycm_extra_conf.py '
specifies the ycm configuration file.- let g:ycm_seed_identifiers_with_syntax = 1
automatically collects keywords according to syntax- let g:ycm_add_preview_to_completeopt = 0
turns off the function prototype prompt- let g:ycm_show_diagnostics_ui = 0
close the error prompt- let g:ycm_semantic_triggers = {}
ycm needs to press ctrl + space to complete by default, you can add the following two lines of code to the above curly brackets to complete directly [no key required]
let g:ycm_semantic_triggers = {
\ 'c,cpp,python,java,go,erlang,perl':['re!\w{2}'],
\ 'cs,lua,javascript':['re!\w{2}'],
\}