Fix corfu, add nerd-icons-corfu

This commit is contained in:
Evie Litherland-Smith 2023-11-14 17:23:49 +00:00
parent 4de72a6f21
commit 91a580a091
2 changed files with 28 additions and 32 deletions

View file

@ -147,6 +147,11 @@
:ensure t
:config (nerd-icons-completion-mode +1))
(use-package nerd-icons-corfu
:ensure t
:after corfu
:config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(keymap-global-set "C-c i n" #'nerd-icons-insert)
(use-package ligature
@ -434,6 +439,7 @@
(use-package orderless
:ensure t
:config (setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles . (partial-completion))))))
(setq corfu-cycle t
@ -450,8 +456,6 @@
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
;; No auto-completion or completion-on-quit in eshell
(defun crafted-completion-corfu-eshell ()
"Special settings for when using corfu with eshell."
(setq-local corfu-quit-at-boundary t
@ -463,18 +467,9 @@
(use-package cape
:ensure t
:config
;; Setup Cape for better completion-at-point support and more
;; Add useful defaults completion sources from cape
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; Silence the pcomplete capf, no errors or messages!
;; Important for corfu
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
;; Ensure that pcomplete does not write to the buffer
;; and behaves as a pure `completion-at-point-function'.
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify))
(use-package consult
@ -492,6 +487,12 @@
("C-r" . consult-history))
:config (setq completion-in-region-function #'consult-completion-in-region))
(use-package consult-yasnippet
:ensure t
:after consult
:commands (consult-yasnippet)
:bind (("C-c s s" . consult-yasnippet)))
(use-package embark
:ensure t
:bind (("<remap> <describe-bindings>" . embark-bindings)
@ -518,11 +519,6 @@
:config
(add-to-list 'completion-at-point-functions #'yasnippet-capf))
(use-package consult-yasnippet
:ensure t
:after consult
:bind (("C-c s s" . consult-yasnippet)))
(unless (package-installed-p 'kbd-mode)
(package-vc-install
'(kbd-mode . (:url "https://github.com/kmonad/kbd-mode"))))
@ -536,6 +532,7 @@
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e
mu4e-completing-read-function #'completing-read-default
mu4e-split-view 'horizontal
mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
@ -573,6 +570,7 @@
(:maildir "/Outlook/Inbox/" :key ?w)))
(use-package mu4e
:after vertico
:bind (("C-c m m" . mu4e)
("C-c m c" . mu4e-compose-new)
("C-c m s" . mu4e-search)

View file

@ -175,6 +175,11 @@
:ensure t
:config (nerd-icons-completion-mode +1))
(use-package nerd-icons-corfu
:ensure t
:after corfu
:config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(keymap-global-set "C-c i n" #'nerd-icons-insert)
#+end_src
@ -516,6 +521,7 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(use-package orderless
:ensure t
:config (setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles . (partial-completion))))))
#+end_src
@ -535,8 +541,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
;; No auto-completion or completion-on-quit in eshell
(defun crafted-completion-corfu-eshell ()
"Special settings for when using corfu with eshell."
(setq-local corfu-quit-at-boundary t
@ -548,18 +552,9 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(use-package cape
:ensure t
:config
;; Setup Cape for better completion-at-point support and more
;; Add useful defaults completion sources from cape
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; Silence the pcomplete capf, no errors or messages!
;; Important for corfu
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
;; Ensure that pcomplete does not write to the buffer
;; and behaves as a pure `completion-at-point-function'.
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify))
#+end_src
@ -579,6 +574,12 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
:map minibuffer-local-map
("C-r" . consult-history))
:config (setq completion-in-region-function #'consult-completion-in-region))
(use-package consult-yasnippet
:ensure t
:after consult
:commands (consult-yasnippet)
:bind (("C-c s s" . consult-yasnippet)))
#+end_src
*** Embark
@ -610,11 +611,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
:after cape
:config
(add-to-list 'completion-at-point-functions #'yasnippet-capf))
(use-package consult-yasnippet
:ensure t
:after consult
:bind (("C-c s s" . consult-yasnippet)))
#+end_src
** Language-specific settings
*** kmonad
@ -635,6 +631,7 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e
mu4e-completing-read-function #'completing-read-default
mu4e-split-view 'horizontal
mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
@ -672,6 +669,7 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(:maildir "/Outlook/Inbox/" :key ?w)))
(use-package mu4e
:after vertico
:bind (("C-c m m" . mu4e)
("C-c m c" . mu4e-compose-new)
("C-c m s" . mu4e-search)