Use selectrum + prescient + orderless + consult instead of ivy + counsel + swiper

This commit is contained in:
Charlotte Van Petegem 2021-03-21 14:41:08 +01:00
parent dddb1bb4ee
commit 91faf61ee6
No known key found for this signature in database
GPG key ID: 019E764B7184435A

View file

@ -26,9 +26,13 @@
"bd" '(kill-this-buffer :which-key "kill") "bd" '(kill-this-buffer :which-key "kill")
"f" '(:ignore t :which-key "file") "f" '(:ignore t :which-key "file")
"ff" '(find-file :which-key "find")
"fs" '(save-buffer :which-key "save") "fs" '(save-buffer :which-key "save")
"h" '(:ignore t :which-key "help") "h" '(:ignore t :which-key "help")
"hb" '(describe-bindings :which-key "bindings")
"hf" '(describe-function :which-key "function")
"hv" '(describe-variable :which-key "variable")
"q" '(:ignore t :which-key "quit") "q" '(:ignore t :which-key "quit")
"qq" '(save-buffers-kill-emacs :which-key "quit") "qq" '(save-buffers-kill-emacs :which-key "quit")
@ -39,11 +43,16 @@
"wv" '(split-window-vertically :which-key "split vertical") "wv" '(split-window-vertically :which-key "split vertical")
"ws" '(split-window-horizontally :which-key "split horizontal") "ws" '(split-window-horizontally :which-key "split horizontal")
"wd" '(delete-window :which-key "delete") "wd" '(delete-window :which-key "delete")
"x" '(M-x :which-key "exec")
) )
) )
;; Better defaults that aren't defaults for some reason. ;; Better defaults that aren't defaults for some reason.
(use-package better-defaults) (use-package better-defaults
;; But don't enable ido-mode...
:config (ido-mode nil)
)
;; Autocomplete ;; Autocomplete
(use-package company (use-package company
@ -51,23 +60,24 @@
:config (global-company-mode) :config (global-company-mode)
) )
;; Replacements for emacs built-ins that better integrate with `ivy'. ;; Prescient in company
(use-package counsel (use-package company-prescient
:config (company-prescient-mode 1)
)
;; Replacements for emacs built-ins that better integrate with `selectrum'.
(use-package consult
:demand t :demand t
:diminish (counsel-mode) :custom (consult-project-root-function #'projectile-project-root "Use projectile to determine project roots.")
:config (counsel-mode 1)
:general :general
(nmap (nmap
:prefix "SPC" :prefix "SPC"
"x" '(counsel-M-x :which-key "exec") "bb" '(consult-buffer :which-key "switch")
"bb" '(counsel-switch-buffer :which-key "switch") "fr" '(consult-recent-file :which-key "recent")
"ff" '(counsel-find-file :which-key "find") "ha" '(consult-apropos :which-key "apropos")
"fr" '(counsel-recentf :which-key "recent") "ss" '(consult-line :which-key "search")
"ha" '(counsel-apropos :which-key "apropos")
"hb" '(counsel-descbinds :which-key "bindings")
"hf" '(counsel-describe-function :which-key "function")
"hv" '(counsel-describe-variable :which-key "variable")
) )
(nmap "/" 'consult-line)
) )
;; Direnv integration in emacs. ;; Direnv integration in emacs.
@ -99,17 +109,6 @@
:config (global-flycheck-mode) :config (global-flycheck-mode)
) )
;; Autocomplete framework
(use-package ivy
:custom
(ivy-count-format "(%d/%d) " "Format used to display match count")
(ivy-height 20 "Maximum height of the ivy buffer")
(ivy-use-virtual-buffers t "Include recent files and bookmarks in buffer switch")
(ivy-wrap t "Wrap next and previous at the end and beginning of the completion list")
:config (ivy-mode 1)
:diminish (ivy-mode)
)
;; Ledger syntax support ;; Ledger syntax support
(use-package ledger-mode (use-package ledger-mode
:mode "\\.journal\\'" :mode "\\.journal\\'"
@ -158,26 +157,27 @@
(modus-themes-load-operandi) (modus-themes-load-operandi)
) )
;; Mail user agent
(use-package mu4e (use-package mu4e
;; Use mu4e included in the mu package, see emacs.nix ;; Use mu4e included in the mu package, see emacs.nix
:ensure nil :ensure nil
:after (ivy)
:demand t :demand t
:after (selectrum)
:custom :custom
(mu4e-change-filenames-when-moving t "Avoid sync issues with mbsync") (mu4e-change-filenames-when-moving t "Avoid sync issues with mbsync")
(mu4e-maildir "/home/charlotte/mail" "Root of the maildir hierarchy") (mu4e-maildir "/home/charlotte/mail" "Root of the maildir hierarchy")
(mu4e-context-policy 'pick-first "Use the first mail context in the list") (mu4e-context-policy 'pick-first "Use the first mail context in the list")
(mu4e-compose-format-flowed t "Flow emails correctly for recipients") (mu4e-compose-format-flowed t "Flow emails correctly for recipients")
(mu4e-attachment-dir "/home/charlotte/downloads" "Save attachments to downloads folder") (mu4e-attachment-dir "/home/charlotte/downloads" "Save attachments to downloads folder")
(mu4e-compose-dont-reply-to-self t "Don't reply to mysel on reply to all") (mu4e-compose-dont-reply-to-self t "Don't reply to myself on reply to all")
(mu4e-confirm-quit nil "Don't confirm when quitting") (mu4e-confirm-quit nil "Don't confirm when quitting")
(mu4e-completing-read-function 'ivy-completing-read "Use ivy for completion") (mu4e-completing-read-function 'completing-read "Use default completing read function")
(mu4e-headers-include-related nil "Don't show related messages by default") (mu4e-headers-include-related nil "Don't show related messages by default")
(message-kill-buffer-on-exit t "Close buffer when finished with email") (message-kill-buffer-on-exit t "Close buffer when finished with email")
(sendmail-program "msmtp" "Use msmtp to send email") (sendmail-program "msmtp" "Use msmtp to send email")
(message-sendmail-f-is-evil t "Remove username from the emacs message") (message-sendmail-f-is-evil t "Remove username from the emacs message")
(message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail to send mail instead internal smtp") (message-send-mail-function 'message-send-mail-with-sendmail "Use sendmail to send mail instead internal smtp")
(message-cite-reply-position 'below) (message-cite-reply-position 'below "Bottom posting is the correct way to reply to email")
:config :config
(setq mu4e-contexts (setq mu4e-contexts
(list (list
@ -300,15 +300,25 @@
;; Nix syntax support ;; Nix syntax support
(use-package nix-mode :mode "\\.nix\\'") (use-package nix-mode :mode "\\.nix\\'")
;; Orderless filtering
(use-package orderless
:after (selectrum)
:custom
(completion-styles '(orderless) "Use orderless for filtering")
(orderless-skip-highlighting (lambda () selectrum-is-active) "This and the setting below are performance optimisations.")
(selectrum-highlight-candidates-function #'orderless-highlight-matches "They make sure only the shown candidates are highlighted.")
)
;; Sorting when filtering
(use-package prescient
:config (prescient-persist-mode 1)
)
;; Project management ;; Project management
(use-package projectile (use-package projectile
:after (ripgrep) :after (ripgrep selectrum)
:demand t :demand t
:diminish (projectile-mode) :diminish (projectile-mode)
:custom
(projectile-completion-system 'ivy "Make sure projectile uses ivy as
the completion system. This should be autodetected, but that doesn't
seem to work")
:config (projectile-mode 1) :config (projectile-mode 1)
:general :general
(nmap (nmap
@ -317,7 +327,8 @@
"pf" '(projectile-find-file :which-key "find") "pf" '(projectile-find-file :which-key "find")
"pp" '(projectile-switch-project :which-key "switch") "pp" '(projectile-switch-project :which-key "switch")
"pr" '(projectile-replace :which-key "replace") "pr" '(projectile-replace :which-key "replace")
"ps" '(projectile-ripgrep :which-key "search") "ps" '(consult-ripgrep :search "incsearch")
"pS" '(projectile-ripgrep :which-key "search")
"p!" '(projectile-run-shell-command-in-root :which-key "command") "p!" '(projectile-run-shell-command-in-root :which-key "command")
"pt" '(projectile-run-term :which-key "term") "pt" '(projectile-run-term :which-key "term")
) )
@ -329,16 +340,18 @@
;; Ripgrep support (needed for `projectile-ripgrep') ;; Ripgrep support (needed for `projectile-ripgrep')
(use-package ripgrep) (use-package ripgrep)
;; `ivy'-integrated buffer search ;; List item selection interface
(use-package swiper (use-package selectrum
:general :custom (selectrum-max-window-height 20 "Allow selector to be a bit higher")
(nmap :config (selectrum-mode 1)
:prefix "SPC" :diminish (selectrum-mode)
"ss" '(swiper :which-key "search")
)
(nmap "/" 'swiper)
) )
;; Prescient integration in selectrum
(use-package selectrum-prescient
:custom (selectrum-prescient-enable-filtering nil "`orderless' manages the filtering part.")
:config (selectrum-prescient-mode 1))
;; HTML (and HTML template) support ;; HTML (and HTML template) support
(use-package web-mode (use-package web-mode
:mode "\\.html'" :mode "\\.html'"