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
counsel-rg from root of project? #836
Comments
You can use the prefix C-u to choose the directory, and the current one is the default, and there you simply can pres backspace until you reach the root. By default I use hydra and to choose always the directory I have something like this: ("r" (let ((current-prefix-arg "-."))
(call-interactively 'counsel-rg)))) |
I have to think about a good way of going about this. It would be easy to check if the current Additionally, if You can look at |
Here's what I use (compatible with Git, Mercurial and Subversion): (require 'dash)
(defun jmb/project-root ()
"Locate the project root (i.e. where the VCS folder is located)
for the currend file."
(let ((n nil))
(--each-while '(".hg/" ".svn/" ".git/") (not n)
(setq n (locate-dominating-file default-directory it)))
n))
(defun jmb/counsel-rg-project-root (&optional extra-args)
(interactive
(list (when current-prefix-arg
(read-string (concat
(car (split-string counsel-rg-base-command))
" with arguments: ")))))
(counsel-rg nil (jmb/project-root) extra-args)) Then bind |
I think it's a good idea to simply search the current directory leave other things for the users. |
I have same mindset with @AbstProcDo I want to use
|
regarding the head post: |
Why not add it to your Note that you can also change the |
I recently switched form counsel-git-grep to counsel-rg to be able to search into submodules. Now I have the opposite problem, when I'm in some folder, the search is done in just that folder. Is there a simple way make counsel-rg always start from the root of the project?
The text was updated successfully, but these errors were encountered: