Use vertico + orderless instead of selectrum + prescient

This commit is contained in:
Jeremy Dormitzer 2023-03-07 13:40:02 -05:00
parent ea7e1ceb76
commit ad011f7ac4

View File

@ -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)