summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-completion.el
blob: 654a9bd9f6239d402625bf55881483fd02eab98e (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
;;; mm-completion.el --- Configuration for Emacs completion  -*- lexical-binding: t; -*-

^L
;;; Vertical Completions

(use-package vertico
  :ensure t
  :hook after-init
  :custom
  (vertico-cycle t)
  :config
  (require 'hl-line))

^L
;;; Annotate Completions

;; TODO: Show git branch descriptions!
(use-package marginalia
  :ensure t
  :hook after-init
  :custom
  (marginalia-field-width 50))

^L
;;; Orderless Completion Style

;; TODO: Make sure this doesn’t suck
(use-package orderless
  :ensure t
  :custom
  (completion-styles '(orderless basic))
  (orderless-matching-styles '(orderless-prefixes))
  (completion-category-overrides '((file (styles basic partial-completion)))))

^L
;;; Completion Popups

(use-package corfu
  :ensure t
  :hook prog-mode
  :bind ( :map corfu-map
          ("C-<return>" . newline))
  :custom
  (corfu-auto t)
  (corfu-cycle t)
  (corfu-auto-prefix 1)
  (corfu-auto-delay .2)
  :config
  ;; I complete with RET and this interferes with ‘tempel-next’
  (keymap-unset corfu-map "TAB" :remove)
  (with-eval-after-load 'savehist
    (corfu-history-mode)
    (add-to-list 'savehist-additional-variables 'corfu-history)))

^L
;;; Save Minibuffer History

(use-package savehist-mode
  :hook (after-init . savehist-mode))

^L
;;; Enhanced Replacements for Builtins

;; TODO: Investigate other commands
(use-package consult
  :ensure t
  :bind ( ([remap switch-to-buffer] . consult-buffer)
          ([remap imenu]            . consult-imenu)
          ([remap goto-line]        . consult-goto-line)
          :map consult-narrow-map
          ("?" . consult-narrow-help))
  :config
  (with-eval-after-load 'project
    (keymap-set project-prefix-map "b" #'consult-project-buffer))
  (with-eval-after-load 'pulsar
    (setopt consult-after-jump-hook nil)
    (dolist (command #'(pulsar-recenter-top pulsar-reveal-entry))
      (add-hook 'consult-after-jump-hook command))))

(provide 'mm-completion)