💾 Archived View for carcosa.net › journal › 20221117-emacs-vertico.gmi captured on 2023-11-04 at 11:30:12. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
I mentioned on [emacs.ch] that to use Emacs effectively, you don't actually have to memorize all of the cryptic multi-chord keybindings for every mode you use. If you know the basics, you can pretty much always do anything you need in just a few keystrokes using M-x and a decent minibuffer completion system. I recommended the lightweight completion stack of `vertico `, `marginalia `, `orderless `, and `prescient `, a set of packages that work well together and with Emacs' built-in completion systems. Someone requested that I post my config, and it took me a while to get to it, but here it is.
;; Enable richer annotations using the Marginalia package (use-package marginalia :ensure t ;; Either bind `marginalia-cycle` globally or only in the minibuffer :bind (("M-A" . marginalia-cycle) :map minibuffer-local-map ("M-A" . marginalia-cycle)) :init (marginalia-mode) (setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))) ;; Enable vertico (use-package vertico :ensure t :commands 'vertico-mode :init (vertico-mode)) ;;; If you always use graphical emacs, you might want your completions to pop up ;;; in a child frame like in some popular graphical editors. ;; (use-package vertico-posframe :ensure t ;; :commands 'vertico-posframe-mode ;; :custom ((vertico-posframe-poshandler #'posframe-poshandler-frame-top-center)) ;; :init (vertico-posframe-mode -1)) (use-package orderless :ensure t :init ;; Tune the global completion style settings to your liking! ;; This affects the minibuffer and non-lsp completion at point. (setq completion-styles '(orderless partial-completion) completion-ignore-case t completion-category-defaults nil completion-category-overrides '((file (styles . (partial-completion)))))) (use-package prescient :ensure t :config (setq prescient-sort-full-matches-first t prescient-use-case-folding t)) (use-package vertico-prescient :ensure t :after (prescient vertico) :config (vertico-prescient-mode))
Note that this guide only covers minibuffer completion, which is what you need for getting the most of M-x. For in-buffer completion (for programming languages or spelling), you will probably want another package, probably `corfu `, to pop up selection menus, though it's also possible with a few more lines of code to use `vertico ` (etc) for in-buffer completion (when you call `completion-at-point `).