I was previously using ag-project to search string in my project. I had it setup so that it opened the relevant buffer on Enter, while keeping the result window open. I could then edit in that window, then M-g n (with compile minor mode) later to jump to the next result.

Now that I am evaluating helm, I try using helm-ag-project-root instead. What breaks my workflow is that I cannot go to the buffer where the match is, without killing the helm result buffer. The least I want to do is to browse the results of my helm search, and be able to scroll the buffers that open.

The best I would like to do is do a search, go to a match, do loads of other stuff, then go back to the result window without searching again, or even directly go to the next match.

I've found this, but don't find it satisfactory.

  • You can do something similar with M-x helm-grep-do-git-grep (or helm-do-grep-ag) by pressing C-x C-s to save the results. Then press M-n/M-p to navigate.
    – jagrg
    Commented May 4, 2020 at 15:12

2 Answers 2


I'm on Spacemacs & am not sure whether this is specific or "universal", but checked at Helm Do Ag's Help:

Previewing an item (search result line):

C-S-j/C-S-down  helm-follow-action-forward -- select next line and preview
C-S-k/C-S-up  helm-follow-action-backward -- select previous line and preview
C-i  <not stated in help> -- preview item on selected line

Scrolling the preview buffer:

C-M-down  helm-scroll-other-window
C-M-up  helm-scroll-other-window-down
<mouse wheel scrolling also works>

There's also C-c C-f to toggle helm-follow-mode, then just next/prev-line does the preview.

I haven't found a reliable way to edit a previewed file while keeping the search buffer opened (sometimes clicking into it & returning via SPC w b works, but sometimes clicking doesn't do anything), but just opening a file, doing some work and returning to the session via SPC r s is enough for me (cursor position in the search results list is being remembered).

(not sure "preview" is the right term, but the buffer gets to the original content when helm session ends)


I faced the exact same problem and I came across this reddit item : https://www.reddit.com/r/spacemacs/comments/5wf24a/preserving_helmminibuffer_results/. You don't need a persistent buffer. You can resume the last helm search by simply pressing SPC r s in Spacemacs. You can resume any last helm session by pressing SPC r l Hope this solves your problem

  • That's better than nothing, thanks. Still need to resume the session, then go to next match. I'm back to my old ag-mode, I had other issues as well (like defaulting to searching thing at point if empty).
    – Gauthier
    Commented May 4, 2020 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.