Improve loading of corfu & treemacs with add-on packages

This commit is contained in:
Evie Litherland-Smith 2024-06-10 08:10:45 +01:00
parent 97e1976af6
commit 3126e5c23b

63
init.el
View file

@ -194,10 +194,9 @@
:init :init
(appt-activate +1)) (appt-activate +1))
(setq inhibit-splash-screen t (setq inhibit-splash-screen t)
use-dialog-box nil
minibuffer-follows-selected-frame nil (setq-default truncate-lines t
truncate-lines nil
truncate-partial-width-windows nil) truncate-partial-width-windows nil)
(global-prettify-symbols-mode +1) (global-prettify-symbols-mode +1)
@ -280,18 +279,6 @@
:requires nerd-icons :requires nerd-icons
:hook (after-init . (lambda () (nerd-icons-completion-mode +1)))) :hook (after-init . (lambda () (nerd-icons-completion-mode +1))))
(use-package nerd-icons-corfu
:diminish
:functions nerd-icons-corfu-formatter
:requires (corfu nerd-icons)
:config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(use-package treemacs-nerd-icons
:diminish
:requires (treemacs nerd-icons)
:config
(treemacs-load-theme "nerd-icons"))
(use-package ligature (use-package ligature
:functions (ligature-set-ligatures :functions (ligature-set-ligatures
global-ligature-mode) global-ligature-mode)
@ -704,6 +691,11 @@
(eglot (styles orderless)) (eglot (styles orderless))
(eglot-capf (styles orderless))))) (eglot-capf (styles orderless)))))
(use-package nerd-icons-corfu
:diminish
:functions nerd-icons-corfu-formatter
:requires nerd-icons)
(use-package corfu (use-package corfu
:defines (corfu-map :defines (corfu-map
corfu-mode-map corfu-mode-map
@ -726,30 +718,28 @@
(corfu-cycle t) (corfu-cycle t)
(corfu-auto nil) (corfu-auto nil)
:config :config
(require 'corfu-popupinfo) (when (require 'nerd-icons-corfu nil :noerror)
(require 'corfu-terminal)) (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(when (require 'corfu-popupinfo nil :noerror)
(corfu-popupinfo-mode +1))
(when (and (require 'corfu-terminal nil :noerror)
(not (display-graphic-p)))
(corfu-terminal-mode +1)))
(use-package corfu-popupinfo (use-package corfu-popupinfo
:requires corfu :requires corfu
:defines corfu-popupinfo-map :defines corfu-popupinfo-map
:functions corfu-popupinfo-mode :functions corfu-popupinfo-mode
:hook (corfu-mode . (lambda () (corfu-popupinfo-mode +1))) :bind ( :map corfu-popupinfo-map
;; :bind ( :map corfu-mode-map ("M-d" . corfu-popupinfo-toggle)
;; ("M-d" . corfu-popupinfo-toggle) ("M-n" . corfu-popupinfo-scroll-up)
;; :map corfu-popupinfo-map ("M-p" . corfu-popupinfo-scroll-down))
;; ("M-n" . corfu-popupinfo-scroll-up)
;; ("M-p" . corfu-popupinfo-scroll-down))
:custom :custom
(corfu-popupinfo-delay 0.3) (corfu-popupinfo-delay 0.3))
:config
(corfu-popupinfo-mode +1))
(use-package corfu-terminal (use-package corfu-terminal
:requires corfu :requires corfu
:functions corfu-terminal-mode :functions corfu-terminal-mode)
:if (not (display-graphic-p))
:custom
(corfu-terminal-mode t))
(use-package cape (use-package cape
:after corfu :after corfu
@ -1000,9 +990,14 @@ Calls `project-remember-projects-under' for ~/Projects/"
(use-package treemacs (use-package treemacs
:functions (treemacs treemacs-load-theme) :functions (treemacs treemacs-load-theme)
:bind (("M-g t" . treemacs-select-window)) :bind (("M-g t" . treemacs-select-window))
:hook (treemacs-mode . (lambda () :hook (treemacs-mode . (lambda () (visual-line-mode -1)))
(visual-line-mode -1) :config
(toggle-truncate-lines -1)))) (when (require 'treemacs-nerd-icons nil :noerror)
(treemacs-load-theme "nerd-icons")))
(use-package treemacs-nerd-icons
:diminish
:requires nerd-icons)
(use-package aggressive-indent (use-package aggressive-indent
:hook (elisp-mode :hook (elisp-mode