-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to change default-directory
when in consult-ripgrep
#596
Comments
I don't understand what you are trying to achieve but searching a specific directory is possible by pressing C-u first (prefix argument). See the docstring of consult-grep. There shouldn't be the need to write code. EDIT: I reread your issue again. The problem is that However there is an alternative better way to achieve what you want, which is less fragile. We simply restart the entire command. (defun consult-ripgrep-up-directory ()
(interactive)
(run-at-time 0 nil #'consult-ripgrep
(file-name-directory (directory-file-name default-directory))
(ignore-errors
(buffer-substring-no-properties
(1+ (minibuffer-prompt-end)) (point-max))))
(minibuffer-quit-recursive-edit))
(consult-customize
consult-ripgrep
:keymap (let ((map (make-sparse-keymap)))
(define-key map (kbd "M-l") #'consult-ripgrep-up-directory)
map)) (Added to the wiki: https://github.com/minad/consult/wiki#restart-consult-ripgrep-in-parent-directory) |
Thank you @minad , works like a charm :) |
Hi @minad, I use
consult-ripgrep
only search current dir not the whole project, code by this:and there is a function binding to
C-l
to change the directory to parent, code like this:When I invoke
C-l
, the search result is fine, but theC-n
(vertico-next) not work as expect, andRET
also not work.The text was updated successfully, but these errors were encountered: