Install the YouCompleteMe plug-in Vim

Source: Internet
Author: User

Install the YouCompleteMe plug-in Vim

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

In my machine installed with python2.7.5 and python3.3, but with the enable-python3interp parameter still does not support py3, somehow, first no matter, YouCompleteMe as long as there is more than py2.6.

Install vundle plug-in

Git clone https://github.com/gmarik/vundle.git ~ /. Vim/bundle/vundle

Configure in. vimrc

Set nocompatible "be iMproved, required
Filetype off "required

"Set the runtime path to include Vundle and initialize
Set rtp + = ~ /. Vim/bundle/vundle/
Call vundle # rc ()
"Alternatively, pass a path where Vundle shocould install plugins
"Let path = '~ /Some/path/here'
"Call vundle # rc (path)

"Let Vundle manage Vundle, required
Plugin 'gmarik/vundle'

"The following are examples of different formats supported.
"Keep Plugin commands between here and filetype plugin indent on.
"Scripts on GitHub repos
Plugin 'tpope/vim-fugitive'
Plugin 'lokaltog/vim-easydemo'
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.html
Plugin 'd9'
Plugin 'fuzzyfinder'
"Scripts not on GitHub
Plugin '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 "required
Bundle 'valloric/youcompleteme'

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.

. Plugin 'gmarik/vundle' | ~
+ Plugin 'tpope/vim-fugitive '| ~
+ Plugin 'lokaltog/vim-easydemo' | ~
+ Plugin 'tpope/vim-rails.git '| ~
+ Plugin 'rstacruz/sparkup' | ~
+ Plugin 'd9' | ~
+ Plugin 'fuzzyfinder '| ~
> Plugin 'git: // git.wincent.com/command-| ~
T. git '| ~
Plugin 'file: // home/gmarik/path/to/pl | ~
Ugin' | ~
Plugin 'valloric/youcompleteme' | ~
Helptags

An error occurs at the end. This is normal because ycm needs to manually compile the warehouse picking 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!

Run under. vim/bundle/YouCompleteMe

./Install. sh -- clang-completer

The parameter is used to support completion of c/c ++.

After the installation is complete, you can use it with some simple configurations.

The configuration file of YouCompleteMe is in/bundle/YouCompleteMe/cpp/ycm/. ycm_extra_conf.py, which is a hidden file.

By default, this file is used. You can copy the file to the root directory of the Project for modification. When opening the project file, the configuration file in the current directory is preferentially used.

If not, ycm_global_ycm_extra_conf in the configuration will be searched.

Add in. vimrc

Let mapleader = "," "this leader is mapped to a comma","

Let g: ycm_global_ycm_extra_conf = '~ /. Vim/bundle/YouCompleteMe/cpp/ycm/. ycm_extra_conf.py '"configure the default ycm_extra_conf.py
Nnoremap <leader> jd: YcmCompleter GoToDefinitionElseDeclaration <CR> "Press, jd will jump to the definition
Let g: ycm_confirm_extra_conf = 0 "When vim is enabled, you will not be asked whether to load ycm_extra_conf.py Configuration
Let g: ycm_collect_identifiers_from_tag_files = 1 "Use the tags file generated by ctags

For more Vim tutorials, see the following:

Build VIM into a simple and practical IDE

Vim Learning Guide

Quick learn Vi Editor

Powerful Vim Editor

Build a Vim Development Environment on CentOS 6.2

Install the highlighted Vim editing tool in CentOS 5.4

Vim tips: C language settings

Set the Vim row number in Ubuntu

Vim editor basic tutorial

This article permanently updates the link address:

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.