Emacs Auto-Complete plug-in Ycmd

Source: Internet
Author: User
Tags git clone

Emacs automatic completion, the best plug-in belongs to Ycmd. The following records my installation process.

1. Installing Ycmd Server

GitHub official address: Https://github.com/Valloric/ycmd

-Git clone ycmd to local ~/ycmd

$ git clone https://github.com/Valloric/ycmd.git ~/ycmd

-Install the necessary compilation tools and libraries

$ sudo apt-get install build-essential cmake python-dev

-Download the full submodule (big oh ... )

$ git submodule update --init --recursive

-Compile (slow oh ... )

$ CD ~/ycmd

$ ./build.py --all

once the compilation is complete, a Ycmd folder is generated in the current directory, and now it's like this ~/ycmd/ycmd

2. Install the Ycmd client and the necessary tools

-Open Emacs, command m-x list-packages, respectively install ycmd, Company-ycmd, Flycheck-ycmd

3. Configuration, add the following to ~/.emacs

;;;; ============================================================================================ < for Ycmd start >

;;;; To use Ycmd-mode on all supported modes
(Require ' Ycmd)
(Add-hook ' After-init-hook # ' Global-ycmd-mode)

;;;; Specify only support C + + mode
;;( Require ' Ycmd)
;;( Add-hook ' C++-mode-hook ' Company-mode)
;;( Add-hook ' C++-mode-hook ' Ycmd-mode)

;;;; Specify how to run the server
(set-variable ' Ycmd-server-command ' ("/usr/bin/python" "/home/peterpan/ycmd/ycmd"))
;;( Set-variable ' Ycmd-server-command ' ("/usr/bin/python" "~/ycmd/ycmd"));; Cannot use ~, should use Abspath

;;;; Specify a global Emacs configuration
(set-variable ' Ycmd-global-config "/home/peterpan/ycmd/examples/.ycm_extra_conf.py")
;;( Set-variable ' Ycmd-global-config "~/ycmd/examples/.ycm_extra_conf.py");; Cannot use ~, should use Abspath

;;;; Completion framework
(Require ' Company-ycmd)
(Company-ycmd-setup)
(Add-hook ' After-init-hook # ' Global-company-mode)

;;;; Enable Flycheck
(Require ' Flycheck-ycmd)
(Flycheck-ycmd-setup)
(Add-hook ' After-init-hook # ' Global-flycheck-mode)

;;;; Set always complete immediately
(setq company-idle-delay 0)


;;;; ============================================================================================ < for ycmd end >

There is a problem: the completion of the time, pop-up tip window, can not press TAB or Ctrl + N key to cycle option, can only continue to enter, until the first is to use, and then press ENTER to select. You need to know how to solve this problem, please tell me:P

Finish.

Emacs Auto-Complete plug-in Ycmd

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.