summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-init-insertion.el
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2019-03-04 04:18:28 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2019-03-04 04:18:28 (GMT)
commit4a4809b65dfcc2a37b906e8aabde7c3b8feae91d (patch)
tree10cbe6a968da743f6f9f27a461e7bb39e0602f97 /lisp/ravi-init-insertion.el
parent96591fdda8bf0fb9b1227de5a4c6dad59c303ec6 (diff)
downloaddotemacs-4a4809b65dfcc2a37b906e8aabde7c3b8feae91d.zip
dotemacs-4a4809b65dfcc2a37b906e8aabde7c3b8feae91d.tar.gz
dotemacs-4a4809b65dfcc2a37b906e8aabde7c3b8feae91d.tar.bz2
Better company UI with company-box
Diffstat (limited to 'lisp/ravi-init-insertion.el')
-rw-r--r--lisp/ravi-init-insertion.el70
1 files changed, 63 insertions, 7 deletions
diff --git a/lisp/ravi-init-insertion.el b/lisp/ravi-init-insertion.el
index 40f2b05..474e73b 100644
--- a/lisp/ravi-init-insertion.el
+++ b/lisp/ravi-init-insertion.el
@@ -80,6 +80,17 @@
company-minimum-prefix-length 2
company-occurrence-weight-function 'company-occurrence-prefer-any-closest
company-dabbrev-downcase nil)
+
+ ;; Company-mode and company (no pun intended) don't play well with dark themes
+ (require 'color)
+ (let ((bg (face-attribute 'default :background)))
+ (custom-set-faces
+ `(company-tooltip ((t (:inherit default :background ,(color-lighten-name bg 10)))))
+ `(company-scrollbar-bg ((t (:background ,(color-lighten-name bg 20)))))
+ `(company-scrollbar-fg ((t (:background ,(color-lighten-name bg 15)))))
+ `(company-tooltip-selection ((t (:inherit font-lock-function-name-face))))
+ `(company-tooltip-common ((t (:inherit font-lock-constant-face))))))
+
(defun ravi/complete-or-indent ()
(interactive)
(if (company-manual-begin)
@@ -116,13 +127,58 @@
;; To do: enable when moving to emacs 26+
;; (use-package company-box :hook (company-mode . company-box-mode) :ensure t)
- (use-package company-quickhelp
- :config
- (progn
- (company-quickhelp-mode 1)
- ;; Enable company-quickhelp only when company-mode is active
- ;; (unbind-key "M-h" company-quickhelp-mode-map)
- (bind-key "M-h" 'company-quickhelp-manual-begin company-active-map)))
+ (setq ravi/use-company-box t)
+ (when ravi/use-company-box
+ (use-package all-the-icons)
+ (use-package company-box
+ :hook (company-mode . company-box-mode)
+ :config
+ (setq company-box-icons-unknown (all-the-icons-faicon "question-circle" :height 0.8))
+
+ (setq company-box-icons-elisp
+ `(,(all-the-icons-faicon "tag" :face font-lock-function-name-face :height 0.8) ;; Function
+ ,(all-the-icons-faicon "cog" :face font-lock-variable-name-face :height 0.8) ;; Variable
+ ,(all-the-icons-faicon "cube" :face font-lock-constant-face :height 0.8) ;; Feature
+ ,(all-the-icons-material "color_lens" :face font-lock-doc-face :height 0.8))) ;; Face
+
+ (setq company-box-icons-yasnippet (all-the-icons-faicon "bookmark" :height 0.8))
+
+ (setq company-box-icons-lsp
+ `((1 . ,(all-the-icons-faicon "text-height" :height 0.8)) ;; Text
+ (2 . ,(all-the-icons-faicon "tags" :face font-lock-function-name-face :height 0.8)) ;; Method
+ (3 . ,(all-the-icons-faicon "tag" :face font-lock-function-name-face :height 0.8)) ;; Function
+ (4 . ,(all-the-icons-faicon "tag" :face font-lock-function-name-face :height 0.8)) ;; Constructor
+ (5 . ,(all-the-icons-faicon "cog" :foreground "#FF9800" :height 0.8)) ;; Field
+ (6 . ,(all-the-icons-faicon "cog" :foreground "#FF9800" :height 0.8)) ;; Variable
+ (7 . ,(all-the-icons-faicon "cube" :foreground "#7C4DFF" :height 0.8)) ;; Class
+ (8 . ,(all-the-icons-faicon "cube" :foreground "#7C4DFF" :height 0.8)) ;; Interface
+ (9 . ,(all-the-icons-faicon "cube" :foreground "#7C4DFF" :height 0.8)) ;; Module
+ (10 . ,(all-the-icons-faicon "cog" :foreground "#FF9800" :height 0.8)) ;; Property
+ (11 . ,(all-the-icons-material "settings_system_daydream" :height 0.8)) ;; Unit
+ (12 . ,(all-the-icons-faicon "cog" :foreground "#FF9800" :height 0.8)) ;; Value
+ (13 . ,(all-the-icons-material "storage" :face font-lock-type-face :height 0.8)) ;; Enum
+ (14 . ,(all-the-icons-material "closed_caption" :foreground "#009688" :height 0.8)) ;; Keyword
+ (15 . ,(all-the-icons-material "closed_caption" :height 0.8)) ;; Snippet
+ (16 . ,(all-the-icons-material "color_lens" :face font-lock-doc-face :height 0.8)) ;; Color
+ (17 . ,(all-the-icons-faicon "file-text-o" :height 0.8)) ;; File
+ (18 . ,(all-the-icons-material "refresh" :height 0.8)) ;; Reference
+ (19 . ,(all-the-icons-faicon "folder-open" :height 0.8)) ;; Folder
+ (20 . ,(all-the-icons-material "closed_caption" :foreground "#009688" :height 0.8)) ;; EnumMember
+ (21 . ,(all-the-icons-faicon "square" :face font-lock-constant-face :height 0.8)) ;; Constant
+ (22 . ,(all-the-icons-faicon "cube" :face font-lock-type-face :height 0.8)) ;; Struct
+ (23 . ,(all-the-icons-faicon "calendar" :height 0.8)) ;; Event
+ (24 . ,(all-the-icons-faicon "square-o" :height 0.8)) ;; Operator
+ (25 . ,(all-the-icons-faicon "arrows" :height 0.8))) ;; TypeParameter
+ )
+ )
+ (unless ravi/use-company-box
+ (use-package company-quickhelp
+ :config
+ (progn
+ (company-quickhelp-mode 1)
+ ;; Enable company-quickhelp only when company-mode is active
+ ;; (unbind-key "M-h" company-quickhelp-mode-map)
+ (bind-key "M-h" 'company-quickhelp-manual-begin company-active-map)))))
(use-package company-statistics
:init