diff options
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/functions.el | 10 | ||||
| -rw-r--r-- | emacs/init.el | 2 |
2 files changed, 11 insertions, 1 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." diff --git a/emacs/init.el b/emacs/init.el index f03c16c..9012a0d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -95,7 +95,7 @@ (use-package consult :bind (("C-x b" . consult-buffer) - ("C-c s" . consult-ripgrep)) + ("C-c s" . my/consult-ripgrep)) :ensure t) (use-package orderless |
