summaryrefslogtreecommitdiffstats
path: root/lisp/init-vertico.el
blob: 747d52d2b8c6ca2790a1edfd7a5f00e09ab974f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;;; init-vertico.el --- a better completion ui  -*- lexical-binding:t -*-
;;; Commentary:
;;; Code:

;; save minibuffer history so that vertico can use it for sorting
(use-package savehist
  :config
  (savehist-mode 1))

;; enhanced search and navigation commands
(use-package consult
  :ensure t
  :bind (("C-x b" . consult-buffer)
         ("C-c i" . consult-imenu)
         ("C-c m" . consult-flymake)))

;; completion style providing fuzzy matching
(use-package orderless
  :ensure t
  :init
  ;; https://github.com/minad/vertico/blob/c36ad0c9471010a0c160268cc6581edf4959e2d3/README.org#configuration
  (setq orderless-matching-styles '(orderless-flex)
        completion-styles '(orderless basic)
        completion-category-defaults nil
        completion-category-overrides '((file (styles partial-completion)))))

;; show rich annotations in the minibuffer
(use-package marginalia
  :ensure t
  :config
  (marginalia-mode 1))

;; a better completion ui
(use-package vertico
  :ensure t
  :config
  (vertico-mode 1))

;; make directory navigation behave like ido
;; https://github.com/minad/vertico/blob/c36ad0c9471010a0c160268cc6581edf4959e2d3/README.org#extensions
(use-package vertico-directory
  :ensure nil
  :after vertico
  :bind (:map vertico-map
              ("RET" . vertico-directory-enter)
              ("DEL" . vertico-directory-delete-char)
              ("M-DEL" . vertico-directory-delete-word))
  :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))

(provide 'init-vertico)

;;; init-vertico.el ends here