spacemacs/contrib/tools/ycmd/packages.el

41 lines
1.3 KiB
EmacsLisp
Raw Normal View History

(setq ycmd-packages
2015-01-10 23:57:24 +00:00
'(
2015-04-01 02:24:01 +00:00
company-ycmd
2015-01-10 23:57:24 +00:00
flycheck-ycmd
2015-04-01 02:24:01 +00:00
ycmd
))
2015-01-10 23:57:24 +00:00
(unless (boundp 'ycmd-server-command)
2015-04-01 02:24:01 +00:00
(message (concat "YCMD won't work unless you set the ycmd-server-command "
"variable to the path to a ycmd install.")))
2015-01-10 23:57:24 +00:00
2015-04-01 02:24:01 +00:00
(defun ycmd/init-company-ycmd ()
(use-package company-ycmd
:if (configuration-layer/layer-usedp 'auto-completion)
2015-04-01 02:24:01 +00:00
:defer t
:commands company-ycmd
2015-04-01 02:24:01 +00:00
:init (push '(company-ycmd :with company-yasnippet)
company-backends-c-mode-common)))
2015-04-01 02:24:01 +00:00
(when (configuration-layer/layer-usedp 'syntax-checking)
(defun ycmd/init-flycheck-ycmd ()
(use-package flycheck-ycmd
:if (configuration-layer/package-usedp 'flycheck)
:defer t
:init (add-hook 'ycmd-mode-hook 'flycheck-ycmd-setup))))
2015-01-10 23:57:24 +00:00
(defun ycmd/init-ycmd ()
(use-package ycmd
2015-03-16 01:43:31 +00:00
:defer t
2015-01-10 23:57:24 +00:00
:init
(progn
2015-03-16 01:43:31 +00:00
;; we don't use ycmd-setup, to correctly lazy-load ycmd we
;; define excplicitly the hooks here
(add-hook 'c++-mode-hook 'ycmd-mode)
(unless (boundp 'ycmd-global-config)
2015-04-04 05:00:41 +00:00
(let ((dir (configuration-layer/get-layer-property 'ycmd :dir)))
(setq-default ycmd-global-config (concat dir "global_conf.py"))))
2015-03-16 01:43:31 +00:00
(evil-leader/set-key-for-mode 'c++-mode
"mgg" 'ycmd-goto
"mgG" 'ycmd-goto-imprecise))))