From ad011f7ac4802c5da42095ee7c7f0fcf3069c960 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 7 Mar 2023 13:40:02 -0500 Subject: [PATCH] Use vertico + orderless instead of selectrum + prescient --- emacs/.emacs.d/config/init-completion.el | 36 +++++++++++------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/emacs/.emacs.d/config/init-completion.el b/emacs/.emacs.d/config/init-completion.el index b6620dc..3739e5f 100644 --- a/emacs/.emacs.d/config/init-completion.el +++ b/emacs/.emacs.d/config/init-completion.el @@ -2,28 +2,28 @@ ;; Nicer minibuffer completion -;; First Selectrum, which provides the core incremental minibuffer completion engine -(use-package selectrum - :config - (selectrum-mode 1) - (leader-def-key "z" #'selectrum-repeat)) +;; First Vertico, which provides the core incremental minibuffer completion engine +(use-package vertico + :init + (vertico-mode)) -;; Then prescient, which adds the ability to sort and filter completions -(use-package selectrum-prescient - :after selectrum - :config - (selectrum-prescient-mode 1) - (prescient-persist-mode 1)) +;; Save history in order to persist sort order across emacs sessions +(use-package savehist + :init + (savehist-mode)) + +;; Then orderless, which adds the ability to filter completions in an intuitive way +(use-package orderless + :ensure t + :custom + (completion-styles '(orderless basic)) + (completion-category-overrides '((file (styles basic partial-completion))))) ;; Marginalia adds annotations to completion candidates (use-package marginalia :demand t :config (marginalia-mode 1) - ;; When using Selectrum, ensure that Selectrum is refreshed when cycling annotations. - (advice-add #'marginalia-cycle :after - (lambda () - (when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))) (add-to-list 'marginalia-prompt-categories '("Find file:" . project-file)) (add-to-list 'marginalia-prompt-categories '("Find dir:" . project-file)) (add-to-list 'marginalia-prompt-categories '("Switch to project" . file)) @@ -136,16 +136,12 @@ targets." ;; Consult adds a bunch of completing-read based utilities (use-package consult - :after selectrum - :commands (consult-xref) :init (setq xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref) :custom - (consult-project-root-function #'projectile-project-root) + (consult-project-function #'projectile-project-root) (consult-find-args "find . -not ( -wholename */.git/* -prune )") - (consult-config '((consult-ripgrep :preview-key nil) - (consult-grep :preview-key nil))) :general ([remap switch-to-buffer] #'consult-buffer) ([remap imenu] #'consult-imenu)