summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.org50
1 files changed, 50 insertions, 0 deletions
diff --git a/config.org b/config.org index 5711a84..5b7ebf9 100644 --- a/config.org +++ b/config.org
@@ -988,6 +988,56 @@ from =undo-fu=.
988 (global-undo-fu-session-mode +1) 988 (global-undo-fu-session-mode +1)
989#+end_src 989#+end_src
990 990
991** Search/Replace
992
993The /biggest/ thing I miss about my Neovim days is its ease of
994search/replace. It didn't matter where the point was in the buffer;
995it could wrap around. It had a little highlight to show you all the
996matching strings, /and/ it could show you what the replacement would
997look like. =anzu= does /most/ of this, except the wrapping around part --
998=ctrlf= does the wrapping around okay, but I haven't really tried to get
999the two packages to play nice together. Until then, I'll just use
1000=anzu= and =isearch=, which is honestly a pretty good search package.
1001
1002*** Regex
1003
1004I search with regex by default.
1005
1006#+begin_src emacs-lisp :noweb-ref settings
1007 (setq-default
1008 ;; Search Regex by default
1009 search-default-mode t)
1010#+end_src
1011
1012I've switched =query-replace= and =query-replace-regexp= with their anzu
1013versions, because of the regex thing.
1014
1015#+begin_src emacs-lisp :noweb-ref bindings
1016 (define-key acdw/map [remap query-replace] #'anzu-query-replace-regexp)
1017 (define-key acdw/map [remap query-replace-regexp] #'anzu-query-replace)
1018
1019 (define-key isearch-mode-map [remap isearch-query-replace]
1020 #'anzu-isearch-query-replace)
1021 (define-key isearch-mode-map [remap isearch-query-replace-regexp]
1022 #'anzu-isearch-query-replace-regexp)
1023#+end_src
1024
1025*** Anzu setup :package:
1026
1027#+begin_src emacs-lisp :noweb-ref packages
1028 (straight-use-package 'anzu)
1029#+end_src
1030
1031#+begin_src emacs-lisp :noweb-ref settings
1032 (setq-default anzu-mode-lighter "" ; hide anzu-mode in the modeline
1033 anzu-replace-to-string-separator " → ")
1034
1035 ;; Set up anzu in the modeline
1036 (setq-default anzu-cons-mode-line-p nil)
1037 (setcar (cdr (assq 'isearch-mode minor-mode-alist))
1038 '(:eval (concat " " (anzu--update-mode-line))))
1039#+end_src
1040
991* Writing 1041* Writing
992 1042
993** Word count :package: 1043** Word count :package: