Ubuntu16.04 Installing Youcompleteme Auto-complete plug-in

Source: Internet
Author: User

Recently, the VMware workstation has been ruined, the virtual machines inside are not open. After the reload after a few days or the same old, simply installed VirtualBox to play.

The first thing is to install the Vim plug-in, make this thing is exhausted, especially install youcompleteme, so the process recorded down here to share.

One installation VIM8.0

First, install vim directly on the Ubuntu16.04

1 sudo apt-get install vim

At this time the installed vim default is 7.4 version, enter the following instructions can be upgraded (Ubuntu can only):

1 sudo add-apt-repository ppa:jonathonf/vim2sudo apt update3 sudo apt Install Vim

After the installation is complete, you can view the following commands:

Vim--version

Now you can see the text message and display your vim version number.

or enter the command vim, you can see the following interface:

Second, installation Vundle

because VIM lacks the default plug-in Manager, all the plug-in files are scattered in several folders under ~/.vim, which causes the installation, update and deletion of various plugins to be handled manually, both troublesome and possible errors. So we need plug-in manager to help, common plugins manager has vundle, pathogen and so on, we use vundle here.

1. Download the Vundle to the ~/.vim/bundle/vundle directory

Vundle is hosted on Github, so use git to download Vundle and store it in ~/.vim/bundle/vundle. Check out the source code directly to the directory using the following command:  

1 git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle 

2. Configure the. vimrc file

Go to the ~ directory and use Ls-al to view the hidden file, if the. vimrc file does not exist, then create it.

First make the following configuration (in order to quickly install, only installed Vundle management plug-in, syntax highlighting plug-ins, auto-complete plug-ins, other plugins can be installed at any time):

1 filetype off2 Setrtp+=~/.vim/bundle/Vundle3 4 Call Vundle#begin ()5 6 7 "to have vundle manage the plug-in version, you must8Bundle'Vundlevim/vundle.vim'9 Ten  OneBundle'Tomasr/molokai' ABundle'Valloric/youcompleteme' -  -Call Vundle#end ()"must be theFileType plugin indent on"vim must be loaded with the appropriate syntax and file type related scripts for the plugin

Save exit, enter the VIM directive, and then : Bundleinstall can install the plugin, for example.

Done after execution :

Tips: Because the youcompleteme is relatively large, so you have to wait for a while, do not have to do before the forced exit, or it will cause the file download is not complete.

Third, compiling ycm_core.so and libclang.so

1. The first thing to install CMake is to compile:

1 sudo apt-get install CMake

Tips

During compilation, if the following error occurs:

The workaround for this error is to install Python-dev, which is a Python header file and a static library package.

1 sudo apt-get install Python-dev

After the execution is complete, the compilation will succeed.

2. Then go to the Youcompleteme folder and compile the. sh file first, as follows

1 $ cd ~/.vim/bundle/youcompleteme23 $./install.sh--clang-completer

3. Then compile the. py file:

1 ./install.py--clang-completer

Compile successfully.

Four, the final configuration

1. Go to the ~/.vim/bundle/youcompleteme/third_party/ycmd folder and enter LS *.so* to see if the following link files are available, indicating that the compilation above is successful.

2. Enter the following command to copy a. ycm_extra_conf.py:

1 cd ~/.vim/bundle/youcompleteme/2 CP./third_party/ycmd/examples/.ycm_extra_conf.py ~/.vim/

3. Edit the. vimrc file, and add a line below the previous filetype plugin indent on :

1 let g:ycm_global_ycm_extra_conf='~/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/. ycm_extra_conf.py'

4. Complete configuration.

Enter . ycm_extra_conf.py file, add the following lines to a bunch of things:

Attention! Attention! Attention!

82 and 84 lines of the digital version number, to go into the/usr/include/c++/under their own to see, may be slightly different.

At this point, our Youcompleteme auto-complete plug-in installation is successful!

Ubuntu16.04 Installing Youcompleteme Auto-complete plug-in

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.