0

I do helm-find-files (C-x c C-x C-f>), Tab, "Grep current directory with AG" (M-g a), enter pattern, Tab, "Save results in grep buffer" (F3). Now, how do I make M-g M-n/M-g M-p work with helm in a sibling buffer, like with rgrep? I was able to achieve this with projectile + rg (C-c p s r).

x-yuri
  • 281
  • 1
  • 8
  • What do you mean with "make `M-g` `M-n` ... work with `helm`? If I do `M-n` in the grep buffer a new window is opened showing the found line in the original file. `M-n` in the grep buffer is bound to `helm-grep-mode-jump-other-window-forward`. – Marioba Sep 19 '21 at 15:18
  • @Marioba You can check it out by doing `M-x rgrep` `Enter` (search for) `some text` (that is present in some files) `Enter` (in files) `all` `Enter` (base directory) `/some/path` `Enter`. After that you get 2 windows: a file with a match and a list of matches. You can use `M-g M-p`/`M-g M-n` in the first window to visit the other matches, even those in the other files. You don't have to switch to the grep buffer to visit the next match. More info is at the link in the question. – x-yuri Sep 19 '21 at 18:35
  • Found the quote: "To visit errors sequentially, type C-x ` (next-error), or equivalently M-g M-n or M-g n. This command can be invoked from any buffer, not just a Compilation mode buffer." – x-yuri Sep 19 '21 at 18:45

1 Answers1

1

I don't see a feature like that in helm-grep. But you should achieve the desired result with a function like this one

(defun my/jump-next-grep-result ()
  (interactive)
  (other-window 1)
  (next-logical-line)
  (helm-grep-mode-jump-other-window-forward 1)
  (other-window -1))
Marioba
  • 736
  • 4
  • 10
  • I wonder is this a bug or a feature that `helm` doesn't have this. To me this is what I occasionally need. I tried discussing it was a [contributor/maintainer](https://github.com/emacs-helm/helm/issues/2065#issuecomment-925344928), and he doesn't agree. Maybe I'm doing it wrong... – x-yuri Oct 13 '21 at 06:41