Replace ivy/counsel with vertico/consult/orderless/marginalia

This commit is contained in:
contrapunctus 2022-01-16 00:59:42 +05:30
parent 6959d557b3
commit 065469efdb
1 changed files with 115 additions and 26 deletions

141
init.org
View File

@ -101,9 +101,7 @@ This needs to be before =boon=/=exwm=, or you get a "failed to define function i
(use-package ido-mini
:demand
:load-path "~/.emacs.d/contrapunctus/ido-mini/"
:bind ("C-x C-l" . ido-mini)
:config
(ivy-mode))
:bind ("C-x C-l" . ido-mini))
#+END_SRC
* exwm :disabled:
@ -1054,6 +1052,16 @@ Don't try to check if there are files with a certain extension...it will lead to
("h" my-help-hydra/body "Help"))
#+END_SRC
** marginalia
:PROPERTIES:
:CREATED: 2022-01-16T00:28:51+0530
:END:
#+BEGIN_SRC emacs-lisp
(use-package marginalia
:ensure t
:init (marginalia-mode))
#+END_SRC
* Searching
:PROPERTIES:
:CUSTOM_ID: search
@ -1078,12 +1086,13 @@ Don't try to check if there are files with a certain extension...it will lead to
:END:
#+BEGIN_SRC emacs-lisp
(use-package swiper
:disabled t
:ensure t
:bind
(("C-s" . swiper)
("C-r" . swiper-backward)
:map swiper-map
("C-c" . previous-line))
:bind (("C-s" . swiper)
("C-r" . swiper-backward))
(:map swiper-map
("C-c" . previous-line)
("C-r" . next-line))
:config
(setq swiper-action-recenter t))
#+END_SRC
@ -1460,7 +1469,8 @@ Suggestion by lampilelo for extending =iso-transl-ctl-x-8-map= (https://dpaste.c
:bind
(:map boon-command-map
("C-l" . recenter-top-bottom)
("p" . swiper)
("p" . my-consult-line)
(". SPC" . #'isearch-forward-symbol-at-point)
("I" . join-line)
;; ("TAB" . 'company-indent-or-complete-common) ;; this works,
;; but also breaks unfolding in org mode :\ ("<tab>" .
@ -1476,7 +1486,6 @@ Suggestion by lampilelo for extending =iso-transl-ctl-x-8-map= (https://dpaste.c
;; are these being buggy?
;; ("(" . boon-navigate-backward)
;; (")" . boon-navigate-forward)
(". p" . swiper-thing-at-point)
("M" . ido-mini)
("H" . ido-mini)
;; these I prefer in their Dvorak positions rather than their QWERTY positions
@ -3120,8 +3129,22 @@ But with =initials=, the desired completion is often buried in the results. That
#+BEGIN_SRC emacs-lisp
(use-package emacs
:config
(setq tags-add-tables nil
completion-styles '(initials partial-completion basic emacs22)))
(setq tags-add-tables nil ;; don't prompt me for tag tables
completion-styles '(initials orderless substring partial-completion emacs22)
completion-cycle-threshold t))
#+END_SRC
=intials= is great for code (or at least Lisp code), but I prefer =orderless= for command names. It is basically the same as Ivy/Counsel completion, as far as I can make out.
** orderless
:PROPERTIES:
:CREATED: 2022-01-13T17:31:53+0530
:END:
#+BEGIN_SRC emacs-lisp
(use-package orderless
:config (setq orderless-component-separator "[ \-]"
orderless-matching-styles
(cons 'orderless-initialism orderless-matching-styles)))
#+END_SRC
** company
@ -3199,18 +3222,94 @@ But with =initials=, the desired completion is often buried in the results. That
:hook (emacs-lisp-mode . yas-global-mode))
#+END_SRC
** counsel
** vertico
:PROPERTIES:
:CREATED: 2022-01-15T18:44:49+0530
:END:
#+BEGIN_SRC emacs-lisp
(use-package vertico
:ensure t
:init (vertico-mode)
(vertico-indexed-mode)
(vertico-multiform-mode)
;; Different scroll margin
;; (setq vertico-scroll-margin 0)
;; Show more candidates
;; (setq vertico-count 20)
;; Grow and shrink the Vertico minibuffer
;; (setq vertico-resize t)
:bind (:map vertico-map
("C-h" . #'vertico-directory-delete-char)
("C-w" . #'vertico-directory-delete-word))
:config
(setq completion-category-defaults nil
completion-category-overrides nil))
#+END_SRC
#+BEGIN_SRC emacs-lisp
;; Persist history over Emacs restarts. Vertico sorts by history position.
(use-package savehist
:init (savehist-mode))
#+END_SRC
#+BEGIN_SRC emacs-lisp
;; A few more useful configurations...
(use-package emacs
:init
;; Add prompt indicator to `completing-read-multiple'.
;; Alternatively try `consult-completing-read-multiple'.
(defun crm-indicator (args)
(cons (concat "[CRM] " (car args)) (cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
;; Vertico commands are hidden in normal buffers.
;; (setq read-extended-command-predicate
;; #'command-completion-default-include-p)
;; Enable recursive minibuffers
(setq enable-recursive-minibuffers t))
#+END_SRC
** consult
:PROPERTIES:
:CREATED: 2022-01-15T21:32:45+0530
:END:
#+BEGIN_SRC emacs-lisp
(use-package consult
:ensure t)
(defun my-consult-line ()
"Like `consult-line', but use symbol at point or active region."
(interactive)
(let ((string (cond ((region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end)))
((or (thing-at-point 'symbol)
(thing-at-point 'url)
(thing-at-point 'word)))
(t nil))))
(consult-line string)))
#+END_SRC
** counsel :disabled:
#+BEGIN_SRC emacs-lisp
(use-package counsel
:disabled t
:ensure t
:bind ("M-x" . counsel-M-x)
:config
(setq counsel-find-file-ignore-regexp "\\`\\."))
#+END_SRC
** ivy
** ivy :disabled:
#+BEGIN_SRC emacs-lisp
(use-package ivy
:disabled t
:ensure t
:commands ivy-mode
:init (ivy-rich-mode) ;; display command docstrings in `counsel-M-x'
@ -3225,9 +3324,10 @@ But with =initials=, the desired completion is often buried in the results. That
'((t . ivy--regex-ignore-order))))
#+END_SRC
** ivy-xref
** ivy-xref :disabled:
#+BEGIN_SRC emacs-lisp
(use-package ivy-xref
:disabled t
:ensure t
:config
(setq xref-show-definitions-function #'ivy-xref-show-defs))
@ -4499,17 +4599,6 @@ Create advice for =lispy-pair= - if =lispy--in-string-or-comment-p= is true, sel
("c" . previous-line))))
#+END_SRC
*** orderless :disabled:
:PROPERTIES:
:CREATED: 2022-01-13T17:31:53+0530
:END:
#+BEGIN_SRC emacs-lisp
(use-package orderless
:disabled t
:custom (completion-styles '(orderless))
:config (setq orderless-component-separator "[ \-]"))
#+END_SRC
** lisp
:PROPERTIES:
:CREATED: 2022-01-13T21:03:15+0530