2017-06-08 11:47:56 +02:00
|
|
|
;;; completion/company/config.el -*- lexical-binding: t; -*-
|
2017-02-19 18:41:26 -05:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! company
|
2018-05-25 00:46:11 +02:00
|
|
|
:commands (company-complete-common company-manual-begin company-grab-line)
|
2018-04-18 18:22:23 -04:00
|
|
|
:init
|
2017-02-19 18:41:26 -05:00
|
|
|
(setq company-idle-delay nil
|
2018-02-02 15:57:49 -05:00
|
|
|
company-tooltip-limit 14
|
2017-02-19 18:41:26 -05:00
|
|
|
company-dabbrev-downcase nil
|
|
|
|
company-dabbrev-ignore-case nil
|
|
|
|
company-dabbrev-code-other-buffers t
|
|
|
|
company-tooltip-align-annotations t
|
|
|
|
company-require-match 'never
|
2018-04-22 23:41:20 -04:00
|
|
|
company-global-modes
|
2018-09-23 16:30:23 -04:00
|
|
|
'(not erc-mode message-mode help-mode gud-mode eshell-mode)
|
2018-10-03 11:18:58 -04:00
|
|
|
company-backends '(company-capf)
|
2018-04-22 23:41:20 -04:00
|
|
|
company-frontends
|
2018-04-23 02:37:58 -04:00
|
|
|
'(company-pseudo-tooltip-frontend
|
2018-08-08 23:34:11 +02:00
|
|
|
company-echo-metadata-frontend))
|
2018-04-18 18:22:23 -04:00
|
|
|
:config
|
2018-07-29 21:31:58 +02:00
|
|
|
(add-hook 'company-mode-hook #'+company|init-backends)
|
2017-02-20 20:43:22 -05:00
|
|
|
(global-company-mode +1))
|
2017-02-19 18:41:26 -05:00
|
|
|
|
|
|
|
|
2018-05-14 20:45:47 +02:00
|
|
|
(def-package! company
|
|
|
|
:when (featurep! +auto)
|
2018-05-25 00:46:11 +02:00
|
|
|
:defer 2
|
2018-06-05 11:20:06 +02:00
|
|
|
:after-call post-self-insert-hook
|
2018-08-25 19:54:11 +02:00
|
|
|
:config (setq company-idle-delay 0.1))
|
|
|
|
|
|
|
|
|
|
|
|
(def-package! company-tng
|
|
|
|
:when (featurep! +tng)
|
|
|
|
:defer 2
|
|
|
|
:after-call post-self-insert-hook
|
|
|
|
:config
|
|
|
|
(add-to-list 'company-frontends 'company-tng-frontend)
|
|
|
|
(define-key! company-active-map
|
2018-12-23 23:57:29 -05:00
|
|
|
"RET" nil
|
|
|
|
[return] nil
|
|
|
|
"TAB" #'company-select-next
|
|
|
|
[tab] #'company-select-next
|
|
|
|
"<backtab>" #'company-select-previous
|
|
|
|
[backtab] #'company-select-previous))
|
2018-05-14 20:45:47 +02:00
|
|
|
|
|
|
|
|
2018-09-07 19:36:16 -04:00
|
|
|
;;
|
|
|
|
;; Packages
|
|
|
|
|
2018-08-04 02:14:43 +02:00
|
|
|
(def-package! company-prescient
|
|
|
|
:hook (company-mode . company-prescient-mode)
|
|
|
|
:config
|
|
|
|
(setq prescient-save-file (concat doom-cache-dir "prescient-save.el"))
|
|
|
|
(prescient-persist-mode +1))
|
|
|
|
|
|
|
|
|
2018-04-22 23:41:53 -04:00
|
|
|
(def-package! company-box
|
|
|
|
:when (and EMACS26+ (featurep! +childframe))
|
|
|
|
:hook (company-mode . company-box-mode)
|
2017-02-20 20:43:22 -05:00
|
|
|
:config
|
2018-04-22 23:41:53 -04:00
|
|
|
(setq company-box-backends-colors nil
|
2018-06-27 19:13:54 +02:00
|
|
|
company-box-max-candidates 50
|
2018-07-05 21:40:34 +02:00
|
|
|
company-box-icons-yasnippet (all-the-icons-material "short_text" :height 0.8 :face 'all-the-icons-green)
|
|
|
|
company-box-icons-unknown (all-the-icons-material "find_in_page" :height 0.8 :face 'all-the-icons-purple)
|
2018-04-22 23:41:53 -04:00
|
|
|
company-box-icons-elisp
|
2018-09-16 18:19:34 -04:00
|
|
|
(list (all-the-icons-material "functions" :height 0.8 :face 'all-the-icons-red)
|
|
|
|
(all-the-icons-material "check_circle" :height 0.8 :face 'all-the-icons-blue)
|
|
|
|
(all-the-icons-material "stars" :height 0.8 :face 'all-the-icons-orange)
|
|
|
|
(all-the-icons-material "format_paint" :height 0.8 :face 'all-the-icons-pink))
|
2018-06-27 19:13:54 +02:00
|
|
|
company-box-icons-lsp
|
2018-09-16 18:19:34 -04:00
|
|
|
`((1 . ,(all-the-icons-material "text_fields" :height 0.8 :face 'all-the-icons-green)) ; text
|
|
|
|
(2 . ,(all-the-icons-material "functions" :height 0.8 :face 'all-the-icons-red)) ; method
|
|
|
|
(3 . ,(all-the-icons-material "functions" :height 0.8 :face 'all-the-icons-red)) ; function
|
|
|
|
(4 . ,(all-the-icons-material "functions" :height 0.8 :face 'all-the-icons-red)) ; constructor
|
|
|
|
(5 . ,(all-the-icons-material "functions" :height 0.8 :face 'all-the-icons-red)) ; field
|
|
|
|
(6 . ,(all-the-icons-material "adjust" :height 0.8 :face 'all-the-icons-blue)) ; variable
|
|
|
|
(7 . ,(all-the-icons-material "class" :height 0.8 :face 'all-the-icons-red)) ; class
|
|
|
|
(8 . ,(all-the-icons-material "settings_input_component" :height 0.8 :face 'all-the-icons-red)) ; interface
|
|
|
|
(9 . ,(all-the-icons-material "view_module" :height 0.8 :face 'all-the-icons-red)) ; module
|
|
|
|
(10 . ,(all-the-icons-material "settings" :height 0.8 :face 'all-the-icons-red)) ; property
|
|
|
|
(11 . ,(all-the-icons-material "straighten" :height 0.8 :face 'all-the-icons-red)) ; unit
|
|
|
|
(12 . ,(all-the-icons-material "filter_1" :height 0.8 :face 'all-the-icons-red)) ; value
|
|
|
|
(13 . ,(all-the-icons-material "plus_one" :height 0.8 :face 'all-the-icons-red)) ; enum
|
|
|
|
(14 . ,(all-the-icons-material "filter_center_focus" :height 0.8 :face 'all-the-icons-red)) ; keyword
|
|
|
|
(15 . ,(all-the-icons-material "short_text" :height 0.8 :face 'all-the-icons-red)) ; snippet
|
|
|
|
(16 . ,(all-the-icons-material "color_lens" :height 0.8 :face 'all-the-icons-red)) ; color
|
|
|
|
(17 . ,(all-the-icons-material "insert_drive_file" :height 0.8 :face 'all-the-icons-red)) ; file
|
|
|
|
(18 . ,(all-the-icons-material "collections_bookmark" :height 0.8 :face 'all-the-icons-red)) ; reference
|
|
|
|
(19 . ,(all-the-icons-material "folder" :height 0.8 :face 'all-the-icons-red)) ; folder
|
|
|
|
(20 . ,(all-the-icons-material "people" :height 0.8 :face 'all-the-icons-red)) ; enumMember
|
|
|
|
(21 . ,(all-the-icons-material "pause_circle_filled" :height 0.8 :face 'all-the-icons-red)) ; constant
|
|
|
|
(22 . ,(all-the-icons-material "streetview" :height 0.8 :face 'all-the-icons-red)) ; struct
|
|
|
|
(23 . ,(all-the-icons-material "event" :height 0.8 :face 'all-the-icons-red)) ; event
|
|
|
|
(24 . ,(all-the-icons-material "control_point" :height 0.8 :face 'all-the-icons-red)) ; operator
|
|
|
|
(25 . ,(all-the-icons-material "class" :height 0.8 :face 'all-the-icons-red))))
|
2018-07-05 21:45:44 +02:00
|
|
|
|
|
|
|
;; Until sebastiencs/company-box#40 is merged
|
|
|
|
(defun +company*box-frontend-even-if-single (command)
|
2018-09-18 17:41:25 -04:00
|
|
|
(cond ((or (eq command 'hide)
|
|
|
|
(equal company-candidates-length 0))
|
2018-07-05 21:45:44 +02:00
|
|
|
(company-box-hide))
|
|
|
|
((eq command 'update)
|
|
|
|
(company-box-show))
|
|
|
|
((eq command 'post-command)
|
|
|
|
(company-box--post-command))))
|
|
|
|
(advice-add #'company-box-frontend :override #'+company*box-frontend-even-if-single))
|
2017-02-20 20:43:22 -05:00
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! company-dict
|
2018-05-25 00:46:11 +02:00
|
|
|
:defer t
|
2017-03-02 18:17:40 -05:00
|
|
|
:config
|
|
|
|
(defun +company|enable-project-dicts (mode &rest _)
|
2017-06-29 16:25:37 +02:00
|
|
|
"Enable per-project dictionaries."
|
2017-03-02 18:17:40 -05:00
|
|
|
(if (symbol-value mode)
|
2018-05-28 12:26:03 +02:00
|
|
|
(add-to-list 'company-dict-minor-mode-list mode nil #'eq)
|
2017-03-02 18:17:40 -05:00
|
|
|
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook 'doom-project-hook #'+company|enable-project-dicts))
|
2017-02-19 18:41:26 -05:00
|
|
|
|