1.下载ycmd server端
# git clone https://github.com/ycm-core/ycmd.git
# git submodule update --init --recursive
2.配置支持的语言
# ./build.py --all //支持所有go语言报错,暂时无解
# ./build.py --clang-completer # --java-completer --system-libclang
3.安装emacs需要的插件
M-X package-install RET ycmd company-ycmd flycheck-ycmd
4.配置
;;YCMD
(require 'ycmd)
;;(add-hook 'c++-mode-hook 'company-mode)
(add-hook 'c++-mode-hook 'ycmd-mode)
;;下载ycmd的路径
(set-variable 'ycmd-server-command
'("python3" "/Users/xxx/github/ycmd"))
(set-variable 'ycmd-global-config "/Users/xxx/github/ycmd/.ycm_extra_conf.py")
(require 'company-ycmd)
(company-ycmd-setup)
(provide 'init-ycmd)
(add-hook 'c++-mode-hook 'company-mode)
来源:oschina
链接:https://my.oschina.net/u/4390903/blog/3231216