this post was submitted on 19 Nov 2023
2 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I'm looking for a way to preview the results of a grep search within files as well as fold the output when there are multiple matches in the same file.

helm-projectile-ag is my current grepping tool but doesn't seem to offer such a facility, unless I haven't read the docs well enough.

My issues are:

  1. It can present a lot of hits in the same file it but lists each one separately. A good option would be to fold the output when there are multiple matches, then I can use the Tab keep to expand the fold and scan through the previews and even edit them right away.

  2. The search panel is modal. It doesn't create a result buffer which you can save and then return to later to continue to select files to edit. Once you lose focus it is gone. It doesn't even seem to retain the search term so you can use it later.

  3. It would be nice to have a window that shows the actual CLI command passed to the search utility. I see them once in a while but it would be good to show them up front or make them easily accessible.

Do any of the project grep tools or helm-projectile-ag itself offer such features?

you are viewing a single comment's thread
view the rest of the comments
[–] Magiel@alien.top 1 points 11 months ago

Consult is what you are looking for: https://github.com/minad/consult In particular try consult-ripgrep