summaryrefslogtreecommitdiff
path: root/emacs/functions.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/functions.el')
-rw-r--r--emacs/functions.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/functions.el b/emacs/functions.el
index 9eb405b..b6e7f1f 100644
--- a/emacs/functions.el
+++ b/emacs/functions.el
@@ -11,6 +11,16 @@
;; Search Helpers
+(defun my/consult-ripgrep (&optional dir)
+ "Call ‘consult-ripgrep’ with the contents of the region as INITIAL
+when possible."
+ (interactive)
+ (if (not (use-region-p))
+ (consult-ripgrep dir)
+ (deactivate-mark)
+ (consult-ripgrep dir (buffer-substring-no-properties
+ (region-beginning) (region-end)))))
+
(defun my/isearch-region (&rest _args)
"Pull the contents of the region into the search string if it
is active."