blob: 295e76c545e21c0a0c8e5a762062a018088ba23f (
plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
;;; Emacs Bedrock
;;;
;;; Extra config: Base enhancements
;;; Usage: Append or require this file from init.el to enable various UI/UX
;;; enhancements.
;;;
;;; The consult package in particular has a vast number of functions that you
;;; can use as replacements to what Emacs provides by default. Please see the
;;; consult documentation for more information and help:
;;;
;;; https://github.com/minad/consult
;;;
;;; In particular, many users may find `consult-line' to be more useful to them
;;; than isearch, so binding this to `C-s' might make sense. This is left to the
;;; user to configure, however, as isearch and consult-line are not equivalent.
;;; Contents:
;;;
;;; - Motion aids
;;; - Power-ups: Embark and Consult
;;; - Minibuffer and completion
;;; - Misc. editing enhancements
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Motion aids
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package avy
:ensure t
:demand t
:bind (("C-c j" . avy-goto-line)
("s-j" . avy-goto-char-timer)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Power-ups: Embark and Consult
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Consult: Misc. enhanced commands
(use-package consult
:ensure t
:bind (
;; Drop-in replacements
("C-x b" . consult-buffer) ; orig. switch-to-buffer
("M-y" . consult-yank-pop) ; orig. yank-pop
;; Searching
("M-s r" . consult-ripgrep)
("M-s l" . consult-line) ; Alternative: rebind C-s to use
("M-s s" . consult-line) ; consult-line instead of isearch, bind
("M-s L" . consult-line-multi) ; isearch to M-s s
("M-s o" . consult-outline)
;; Isearch integration
: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
)
:config
;; Narrowing lets you restrict results to certain groups of candidates
(setq consult-narrow-key "<"))
(use-package embark
:ensure t
:demand t
:after avy
:bind (("C-c a" . embark-act)) ; bind this to an easy key to hit
:init
;; Add the option to run embark when using avy
(defun bedrock/avy-action-embark (pt)
(unwind-protect
(save-excursion
(goto-char pt)
(embark-act))
(select-window
(cdr (ring-ref avy-ring 0))))
t)
;; After invoking avy-goto-char-timer, hit "." to run embark at the next
;; candidate you select
(setf (alist-get ?. avy-dispatch-alist) 'bedrock/avy-action-embark))
(use-package embark-consult
:ensure t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Minibuffer and completion
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Vertico: better vertical completion for minibuffer commands
(use-package vertico
:ensure t
:init
;; You'll want to make sure that e.g. fido-mode isn't enabled
(vertico-mode))
(use-package vertico-directory
:ensure nil
:after vertico
:bind (:map vertico-map
("M-DEL" . vertico-directory-delete-word)))
;; Marginalia: annotations for minibuffer
(use-package marginalia
:ensure t
:config
(marginalia-mode))
;; Popup completion-at-point
(use-package corfu
:ensure t
:init
(global-corfu-mode)
:bind
(:map corfu-map
("SPC" . corfu-insert-separator)
("C-n" . corfu-next)
("C-p" . corfu-previous)))
;; Part of corfu
(use-package corfu-popupinfo
:after corfu
:ensure nil
:hook (corfu-mode . corfu-popupinfo-mode)
:custom
(corfu-popupinfo-delay '(0.25 . 0.1))
(corfu-popupinfo-hide nil)
:config
(corfu-popupinfo-mode))
;; Make corfu popup come up in terminal overlay
(use-package corfu-terminal
:if (not (display-graphic-p))
:ensure t
:config
(corfu-terminal-mode))
;; Fancy completion-at-point functions; there's too much in the cape package to
;; configure here; dive in when you're comfortable!
(use-package cape
:ensure t
:init
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-file))
;; Pretty icons for corfu
(use-package kind-icon
:if (display-graphic-p)
:ensure t
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(use-package eshell
:init
(defun bedrock/setup-eshell ()
;; Something funny is going on with how Eshell sets up its keymaps; this is
;; a work-around to make C-r bound in the keymap
(keymap-set eshell-mode-map "C-r" 'consult-history))
:hook ((eshell-mode . bedrock/setup-eshell)))
;; Eat: Emulate A Terminal
(use-package eat
:ensure t
:custom
(eat-term-name "xterm")
:config
(eat-eshell-mode) ; use Eat to handle term codes in program output
(eat-eshell-visual-command-mode)) ; commands like less will be handled by Eat
;; Orderless: powerful completion style
(use-package orderless
:ensure t
:config
(setq completion-styles '(orderless)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Misc. editing enhancements
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Modify search results en masse
(use-package wgrep
:ensure t
:config
(setq wgrep-auto-save-buffer t))
|