Skip to content
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

Feature request: Support rg-rerun-change-project in rg-mode #165

Open
sukiida opened this issue Apr 15, 2024 · 1 comment
Open

Feature request: Support rg-rerun-change-project in rg-mode #165

sukiida opened this issue Apr 15, 2024 · 1 comment

Comments

@sukiida
Copy link

sukiida commented Apr 15, 2024

Maybe the feature is already there and I'm not aware of it.

I'm working on a super project consists of many sub-projects. Usually I need to search through sub projects to trace a variable or something. It would be great if I can do it with rg-dwim, change project and rerun search. (I love the search and refine procedure.)

It is like rg-rerun-change-dir, but doesn't need so many keystrokes to navigate to the dest directory. Actually I have a piece of demo code work with projectile locally, still I would be happy to complete it and support other packages such as project.el etc. if you appove. Thnaks.

;; extend rg.el
;; add a rg-mode command to switch project and rerun search
(defun rg-rerun-change-project()
  "Rerun last search but prompt for new project."
  (interactive)
  (setf (rg-search-dir rg-cur-search)
           (let ((projects (projectile-relevant-open-projects)))
             (if projects
                 (projectile-completing-read
                  "Switch to open project: " projects)
               (rg-search-dir rg-cur-search))))
  (rg-rerun))

;; add to rg-mode key map
(define-key rg-mode-map "P" 'rg-rerun-change-project)
@dajva
Copy link
Owner

dajva commented Sep 7, 2024

Sorry for late reply. I have not been active here lately. But yes, I think the suggestion sounds reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants