CentOS7 Vim Automatic completion Plug-In ---- YouCompleteMe installation and configuration, youcompleteme
Recently I installed CentOS7, a new system. to configure the encoding environment, I used neocomplcache + code_complete + omnicppcomplete to write programs using Vim. However, when searching online, you can see YouCompleteMe, which means YCM is better. I also like new things, so I decided to install YCM. However, the installation process has encountered many pitfalls. The online tutorials have different installation methods, and I have tried them all over. In the end, I finally finished it after an afternoon. Now I can post the Feasible installation and configuration methods for reference.
YouCompleteMe: a key-based plug-in that supports fuzzy search and high-speed completion. YCM is developed by Strahinja Val Markovic, a software engineer in the google search project team. The YCM backend calls libclang (to obtain AST, and of course there are semantic analysis libraries in other languages) the front end is developed by C ++ (to improve the completion rate), and the outer layer is encapsulated by python (to become the vim plug-in). It may be the most complicated vim plug-in I have ever seen.
To install YouCompleteMe, vim must support python. Check whether it is supported. You can view it in vim: version. If there is a + sign before python, It is supported, and the minus sign is not supported.
If not, compile and install vim. Compilation configuration options:
./configure --with-features=huge --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset
1. Install the vundle plug-in
Step 1:
[zhupengfei@localhost ~]$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle^C
Step 2: Configure in. vimrc
[zhupengfei@localhost ~]$ vim .vimrc
set nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/vundle/call vundle#rc()" alternatively, pass a path where Vundle should install plugins"let path = '~/some/path/here'"call vundle#rc(path)" let Vundle manage Vundle, requiredPlugin 'gmarik/vundle'" The following are examples of different formats supported." Keep Plugin commands between here and filetype plugin indent on." scripts on GitHub reposPlugin 'tpope/vim-fugitive'Plugin 'Lokaltog/vim-easymotion'Plugin 'tpope/vim-rails.git'" The sparkup vim script is in a subdirectory of this repo called vim." Pass the path to set the runtimepath properly.Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}" scripts from http://vim-scripts.org/vim/scripts.htmlPlugin 'L9'Plugin 'FuzzyFinder'" scripts not on GitHubPlugin 'git://git.wincent.com/command-t.git'" git repos on your local machine (i.e. when working on your own plugin)Plugin 'file:///home/gmarik/path/to/plugin'" ...filetype plugin indent on " requiredBundle 'Valloric/YouCompleteMe'
Step 3: Save and exit. Open vim and enter BundleInstall for automatic installation.
The process is as follows. + indicates that the process has been installed.> indicates that the process is being installed.
[zhupengfei@localhost ~]$ vim
:BundleInstall
An error occurs during installation. This is normal because ycm needs to manually compile the warehouse file.
Done! With errors; press l to view log
Ycm_client_support. [so | pyd | dll] and ycm_core. [so | pyd | dll] not detected; you need to compile YCM before using it. Read the docs!
Ii. install and configure YouCompleteMe
Step 4: run the following command in. vim/bundle/YouCompleteMe:
./Install. sh -- clang-completer
The parameter is used to support completion of c/c ++.
[zhupengfei@localhost YouCompleteMe]$ ./install.sh --clang-complete
Then, an error may occur:
Some folders in/home/sky-tm/. vim/bundle/YouCompleteMe/third_party/ycmd/third_party are empty; you probably forgot to run: git submodule update -- init -- recursive
If this error occurs, follow the prompts and enter the following command:
Git submodule update -- init -- recursive
[zhupengfei@localhost YouCompleteMe]$git submodule update --init --recursive
After the command is updated, run the following command:
./Install. sh -- clang-completer
[zhupengfei@localhost YouCompleteMe]$ ./install.sh --clang-complete
After the installation is complete, you can use it with some simple configurations.
You need to find a ycm_global_ycm_extra_conf file when completing YouCompleteMe. You can place this file in the working directory each time, or set global. To set global settings, add a row to. vimrc.
Note:. ycm_extra_conf.py is a hidden file in ~ /. Vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/. ycm_extra_conf.py
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py '
The configuration of. vimrc will not be pasted, there are many online, you can configure according to personal preferences.