about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-01-26 12:06:46 -0600
committerCase Duckworth2021-01-26 12:06:46 -0600
commite2eae4cc35293c3895f272e8cd88e6498e6985b3 (patch)
tree888d71cfa6b50fd0ea363b69b26e238ea2e1e09e
parentI'm guessing ... whitespace? (diff)
downloademacs-e2eae4cc35293c3895f272e8cd88e6498e6985b3.tar.gz
emacs-e2eae4cc35293c3895f272e8cd88e6498e6985b3.zip
Add CRUX
-rw-r--r--config.org61
1 files changed, 48 insertions, 13 deletions
diff --git a/config.org b/config.org index e088f46..66e677e 100644 --- a/config.org +++ b/config.org
@@ -164,10 +164,10 @@ to switch to the other buffer if there's only one window in the frame.
164 (other-window 1))) 164 (other-window 1)))
165#+end_src 165#+end_src
166 166
167And I'll bind it to =M-o=, since that's easier to reach than =C-x o=. 167*** Switch to other window or buffer :crux:
168 168
169#+begin_src emacs-lisp :noweb-ref bindings 169#+begin_src emacs-lisp :noweb-ref bindings
170 (define-key acdw/map (kbd "M-o") #'other-window-or-buffer) 170 (define-key acdw/map (kbd "M-o") #'crux-other-window-or-switch-buffer)
171#+end_src 171#+end_src
172 172
173** Buffers 173** Buffers
@@ -796,6 +796,20 @@ According to [[https://github.com/mpereira/.emacs.d#make-cursor-movement-an-orde
796 fast-but-imprecise-scrolling t) 796 fast-but-imprecise-scrolling t)
797#+end_src 797#+end_src
798 798
799** CRUX :package:crux:
800
801A collection of generally-useful functions that I don't want to bother
802including here myself. This is kind of an experiment, to be honest.
803
804#+begin_src emacs-lisp :noweb-ref packages
805 (straight-use-package '(crux
806 :host github
807 :repo "bbatsov/crux"))
808#+end_src
809
810A note: I /don't/ do the same with [[https://github.com/alphapapa/unpackaged.el][unpackaged]] (see below, specifically
811the *Org* sections) because it pulls in =hydra= and =use-package=, et al.
812
799* Persistence 813* Persistence
800 814
801** Minibuffer history 815** Minibuffer history
@@ -1150,6 +1164,13 @@ It manages my whitespace for me, anyway.
1150 (setq-default kill-do-not-save-duplicates t) 1164 (setq-default kill-do-not-save-duplicates t)
1151#+end_src 1165#+end_src
1152 1166
1167*** Kill the line if there is no region :crux:
1168
1169#+begin_src emacs-lisp :noweb-ref hooks
1170 (crux-with-region-or-line kill-ring-save)
1171 (crux-with-region-or-line kill-region)
1172#+end_src
1173
1153** Overwrite mode 1174** Overwrite mode
1154 1175
1155*** Change the cursor 1176*** Change the cursor
@@ -1218,6 +1239,22 @@ look like. =anzu= does /most/ of this, except the wrapping around part --
1218the two packages to play nice together. Until then, I'll just use 1239the two packages to play nice together. Until then, I'll just use
1219=anzu= and =isearch=, which is honestly a pretty good search package. 1240=anzu= and =isearch=, which is honestly a pretty good search package.
1220 1241
1242*** Anzu setup
1243
1244#+begin_src emacs-lisp :noweb-ref packages
1245 (straight-use-package 'anzu)
1246#+end_src
1247
1248#+begin_src emacs-lisp :noweb-ref settings
1249 (setq-default anzu-mode-lighter "" ; hide anzu-mode in the modeline
1250 anzu-replace-to-string-separator " → ")
1251
1252 ;; Set up anzu in the modeline
1253 (setq-default anzu-cons-mode-line-p nil)
1254 (setcar (cdr (assq 'isearch-mode minor-mode-alist))
1255 '(:eval (concat " " (anzu--update-mode-line))))
1256#+end_src
1257
1221*** Regex 1258*** Regex
1222 1259
1223I search with regex by default. 1260I search with regex by default.
@@ -1241,20 +1278,18 @@ versions, because of the regex thing.
1241 #'anzu-isearch-query-replace-regexp) 1278 #'anzu-isearch-query-replace-regexp)
1242#+end_src 1279#+end_src
1243 1280
1244*** Anzu setup :package: 1281** Commenting :crux:
1245 1282
1246#+begin_src emacs-lisp :noweb-ref packages 1283I don't think the default =M-;= (=M-x comment-dwim=) binding makes sense.
1247 (straight-use-package 'anzu) 1284I want it to comment out the region or line, or uncomment it if it's
1248#+end_src 1285already commented. That's it.
1249 1286
1250#+begin_src emacs-lisp :noweb-ref settings 1287#+begin_src emacs-lisp :noweb-ref hooks
1251 (setq-default anzu-mode-lighter "" ; hide anzu-mode in the modeline 1288 (crux-with-region-or-line comment-or-uncomment-region)
1252 anzu-replace-to-string-separator " → ") 1289#+end_src
1253 1290
1254 ;; Set up anzu in the modeline 1291#+begin_src emacs-lisp :noweb-ref bindings
1255 (setq-default anzu-cons-mode-line-p nil) 1292 (define-key acdw/map (kbd "M-;") #'comment-or-uncomment-region)
1256 (setcar (cdr (assq 'isearch-mode minor-mode-alist))
1257 '(:eval (concat " " (anzu--update-mode-line))))
1258#+end_src 1293#+end_src
1259 1294
1260* Writing 1295* Writing