about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2023-05-23 16:06:03 +0100
committerDavid Morgan <djm_uk@protonmail.com>2023-05-23 16:06:03 +0100
commit6ea07273e7d8b190e3fa8eb29634da89ecde3051 (patch)
tree5af20e262c75b95eda7c33c573e50f6d667cf6d3
parent78903f9b75857f4941cb6cc4a381f720efb2d111 (diff)
downloaddotfiles-6ea07273e7d8b190e3fa8eb29634da89ecde3051.tar.gz
Add deadgrep-all function
-rw-r--r--.emacs.d/lisp/init-search.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-search.el b/.emacs.d/lisp/init-search.el
index 9d4e487..fba07e1 100644
--- a/.emacs.d/lisp/init-search.el
+++ b/.emacs.d/lisp/init-search.el
@@ -62,12 +62,23 @@
   (defun deadgrep-current-directory (search-term)
     (interactive (list (deadgrep--read-search-term)))
     (deadgrep search-term (file-name-directory buffer-file-name)))
+  (defvar include-all nil)
+  (defun deadgrep--include-all-advice (rg-args)
+    (when include-all
+      (push "-uuuLz" rg-args)))
+  (advice-add 'deadgrep--arguments :filter-return #'deadgrep--include-all-advice)
+  (defun deadgrep-all (search-term)
+    (interactive (list (deadgrep--read-search-term)))
+    (let ((include-all t))
+      (deadgrep search-term)))
   :bind
   ("C-c c d" . deadgrep)
+  ("C-c c M-d" . deadgrep-all)
   ("C-S-z" . deadgrep-symbol-at-point)
   ("C-c c C-d" . deadgrep-current-directory)
   (:map search-map
         ("d" . deadgrep)
+        ("M-d" . deadgrep-all)
         ("C-d" . deadgrep-current-directory)
         ("D" . deadgrep-symbol-at-point)))