Orderless, Selectrum, Prescient, and Consult – Basic Setup
Intro
New Trend
Individual packages that work together
orderless - completion style spaces any order
selectrum - offers vertical completion
prescient - filters most recent completions to the top of the list
consult - provides commands which allow one to quickly select an item from a list of candidates with completion
Install with straight
(defvar bootstrap-version) ;; straight (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'orderless) (straight-use-package 'selectrum) (straight-use-package 'selectrum-prescient) (straight-use-package 'consult)
One can also install easily with package.el
;; Setup package archive (package-initialize) (setq package-archives '(("melpa" . "https://melpa.org/packages/"))) (package-refresh-contents) ;; Install packages (package-install 'consult) (package-install 'marginalia) (package-install 'orderless) (package-install 'selectrum) (package-install 'selectrum-prescient)
Config
(require 'orderless) (setq completion-styles '(orderless)) (selectrum-mode +1) (setq selectrum-prescient-enable-filtering nil) (selectrum-prescient-mode +1) (prescient-persist-mode +1) (require 'consult)
And these variables enhance speed and highlighting:
(setq orderless-skip-highlighting (lambda () selectrum-is-active)) (setq selectrum-highlight-candidates-function #'orderless-highlight-matches)
Examples
M-x emacs-init-time
f8 emacs diary
C-x C-f captured
Customisations and features
(global-set-key (kbd "<f7>") 'consult-outline) (global-set-key [C-tab] 'consult-buffer) (global-set-key (kbd "C-x C-r") 'consult-recent-file)
Good with org-mode files
Supported narrowing keys:
b Buffers + space
f Files + space
m Bookmarks + space
Turn off preview
consult-preview-key nil
for narrowing during completion
Other features
consult-grep # + #filter
asynchronous
consult-line
consult-isearch
Assess
Variable completion
M-x
Email
Buffer creation
https://www.reddit.com/r/emacs/comments/m9avdn/orderless_selectrum_prescient_and_consult_basic/
https://youtu.be/lfgQC540sNM