Emacs - YCMD

Table of Contents

Introduction

YouCompleteMe (YCM) is originally a completion framework for VIM1, and afterwards splitted into a general server and a client. The general server, namely YCM daemon (YCMD)2, is able to provide interface to a variety of clients beyond VIM, e.g. Emacs. Moreover, both company and auto-complete can directly utilize what the server/daemon provides.

Installation

Emacs packages

Install the Emacs packages via ELPA, ycmd, company-ycmd, company.

Dependency

pacman -S boost

YCMD

Install the YCMD to ~/.emacs.d/ycmd.

cd ~/.emacs.d
git clone https://github.com/Valloric/ycmd.git
cd ycmd
git submodule update --init --recursive
./build.py --clang-completer --system-libclang --system-boost

Configurations

  • ~/.emacs.d/ycmd/global_config.py
cp ~/.emacs.d/ycmd/examples/.ycm_extra_conf.py ~/.emacs.d/ycmd/global_config.py

After that, customize it to meet your requirements.

  • ~/.emacs
...

;;; Company
(add-hook 'after-init-hook 'global-company-mode) 
(setq company-idle-delay 0) 
(company-auctex-init) 

;;; Ycmd
(add-hook 'after-init-hook #'global-ycmd-mode)
(set-variable 'ycmd-server-command '("python2" "/home/shaka/.emacs.d/ycmd/ycmd"))
(set-variable 'ycmd-global-config "/home/shaka/.emacs.d/ycmd/global_config.py") 
(company-ycmd-setup)

...

Footnotes: