2022-08-20 17:16:01 +02:00
|
|
|
(use-package company
|
2023-01-13 09:23:51 +01:00
|
|
|
:init
|
|
|
|
(add-hook 'after-init-hook 'global-company-mode)
|
2022-08-20 17:16:01 +02:00
|
|
|
:bind
|
|
|
|
("C-<tab>" . company-complete)
|
|
|
|
:config
|
|
|
|
(setq company-idle-delay 0)
|
|
|
|
(define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
|
|
|
|
(define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle)
|
|
|
|
(setq company-dabbrev-downcase nil)
|
|
|
|
|
|
|
|
;; Add yasnippet support for all company backends
|
|
|
|
(defvar company-mode/enable-yas t
|
|
|
|
"Enable yasnippet for all backends.")
|
|
|
|
(defun company-mode/backend-with-yas (backend)
|
|
|
|
(if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
|
|
|
|
backend
|
|
|
|
(append (if (consp backend) backend (list backend))
|
|
|
|
'(:with company-yasnippet))))
|
|
|
|
(setq company-backends (mapcar #'company-mode/backend-with-yas company-backends)))
|