769d54da02
Move company and auto-complete to a common layer. They are not enabled globally anymore, each mode using them must explicitly declare a hook. Only one frontend is supported for a given mode, we have to choose the best between the two. Only one key binding to toggle auto-completion on `SPC t a` no matter if it is company or auto-complete. The lighter in the mode-line is Ⓐ for both frontends.
39 lines
1.3 KiB
EmacsLisp
39 lines
1.3 KiB
EmacsLisp
(defvar ycmd-packages
|
|
'(
|
|
company-ycmd
|
|
flycheck-ycmd
|
|
ycmd
|
|
)
|
|
"List of all packages to install and/or initialize. Built-in packages
|
|
which require an initialization must be listed explicitly in the list.")
|
|
|
|
(unless (boundp 'ycmd-server-command)
|
|
(message (concat "YCMD won't work unless you set the ycmd-server-command "
|
|
"variable to the path to a ycmd install.")))
|
|
|
|
(defun ycmd/init-company-ycmd ()
|
|
(use-package company-ycmd
|
|
:if (configuration-layer/layer-declaredp 'auto-completion)
|
|
:defer t
|
|
:init (push '(company-ycmd :with company-yasnippet)
|
|
company-backends-c-c++)))
|
|
|
|
(defun ycmd/init-flycheck-ycmd ()
|
|
(use-package flycheck-ycmd
|
|
:defer t
|
|
:init (add-hook 'ycmd-mode-hook 'flycheck-ycmd-setup)))
|
|
|
|
(defun ycmd/init-ycmd ()
|
|
(use-package ycmd
|
|
:defer t
|
|
:init
|
|
(progn
|
|
;; we don't use ycmd-setup, to correctly lazy-load ycmd we
|
|
;; define excplicitly the hooks here
|
|
(add-hook 'c++-mode-hook 'ycmd-mode)
|
|
(setq-default ycmd-global-config
|
|
(expand-file-name (concat user-emacs-directory
|
|
"contrib/ycmd/global_conf.py")))
|
|
(evil-leader/set-key-for-mode 'c++-mode
|
|
"mgg" 'ycmd-goto
|
|
"mgG" 'ycmd-goto-imprecise))))
|