Switch to vertico, orderless, marginalia, consult, and embark

Instead of counsel, ivy, and swiper
This commit is contained in:
Marcel Kapfer 2023-01-03 16:29:21 +01:00
parent a157d0b927
commit e6617a7b33
Signed by: mmk2410
GPG Key ID: CADE6F0C09F21B09
1 changed files with 129 additions and 22 deletions

View File

@ -780,38 +780,145 @@ Source: [[https://github.com/Alexander-Miller/treemacs][Alexander-Miller/treemac
:after (treemacs evil))
#+end_src
** counsel, ivy and swiper
** vertico
Emacs package collection (ivy, swiper and counsel) of flexible, simple tools for minibuffer completion.
Vertico is a minimal completion UI that uses core Emacs functionality whenever possible.
Source: [[https://github.com/abo-abo/swiper][GitHub: abo-abo/swiper]]
[[https://github.com/minad/vertico][GitHub: minad/vertico]]
#+begin_src emacs-lisp
(use-package counsel
:bind ("M-x" . counsel-M-x))
(use-package ivy
:after (counsel)
:diminish (ivy-mode)
:config
(ivy-mode t)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
:bind
(("C-c g" . counsel-git)
("C-s" . swiper)
("C-r" . swiper)))
(use-package vertico
:init
(vertico-mode)
(setq vertico-scroll-margin 0)
(setq vertico-resize t)
(setq vertico-cycle t))
#+end_src
** ivy-rich
** orderless
ivy-rich enhances M-x and similar even more by giving more information directly in the minibuffer.
Emacs completion style that matches multiple regexps in any order
Source: [[https://github.com/Yevgnen/ivy-rich][GitHub: Yevgnen/ivy-rich]]
[[https://github.com/oantolin/orderless][GitHub: oantolin/orderless]]
#+begin_src emacs-lisp
(use-package ivy-rich
:init (ivy-rich-mode 1))
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion)))))
#+end_src
** marginalia
Marginalia in the minibuffer.
[[https://github.com/minad/marginalia][GitHub: minad/marginalia]]
#+begin_src emacs-lisp
(use-package marginalia
:init
(marginalia-mode)
:bind (:map minibuffer-local-map
("M-A" . marginalia-cycle)))
#+end_src
** consult
#+begin_src emacs-lisp
(use-package consult
;; Replace bindings. Lazily loaded due by `use-package'.
:bind (;; C-c bindings (mode-specific-map)
("C-c h" . consult-history)
("C-c m" . consult-mode-command)
("C-c k" . consult-kmacro)
;; C-x bindings (ctl-x-map)
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings (goto-map)
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g M-g" . consult-goto-line) ;; orig. goto-line
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings (search-map)
("M-s d" . consult-find)
("M-s D" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s m" . consult-multi-occur)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
(advice-add #'register-preview :override #'consult-register-window)
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
:config
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
:preview-key '(:debounce 0.4 any))
(setq consult-narrow-key "<"))
#+end_src
** embark
Emacs Mini-Buffer Actions Rooted in Keymaps
[[https://github.com/oantolin/embark][GitHub: oantolin/embark]]
#+begin_src emacs-lisp
(use-package embark
:bind
(("C-." . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init
(setq prefix-help-command #'embark-prefix-help-command)
:config
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
(use-package embark-consult
:hook
(embark-collect-mode . consult-preview-at-point-mode))
#+end_src
** avy