Created
January 2, 2023 03:25
-
-
Save hidsh/61418c02ac714f2b2894f1ed24eba365 to your computer and use it in GitHub Desktop.
elisp: consult-ripgrep with symbol-at-point and directory to search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-consult-ripgrep (&optional parg dir initial) | |
"`consult-ripgrep` with symbol-at-point. | |
Besides, it can be Specified top directory to search using prefix-argument, e.g. C-u." | |
(interactive "p") | |
(setq initial (thing-at-point 'symbol)) | |
(setq dir (pcase parg | |
(1 nil) ;; not given prefix-arg | |
(t (let ((insert-default-directory t)) | |
(read-directory-name "Ripgrep Dir: "))))) | |
(consult-ripgrep dir initial))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment