6

I've been trying to switch to Ivy from Helm for the past little while. One feature I miss (and because of this I keep helm installed) is the ability to run helm-ag, and then to hit C-c C-e so I can edit the lines in the file that helm-ag matched.

Is there any equivalent functionality with Ivy/Swiper/Projectile/etc.?

Ashton Wiersdorf
  • 349
  • 1
  • 11

1 Answers1

4

Thanks to this blogpost, I found a solution. The real tool that I was looking for was wgrep which does the multi-editing heavy lifting that I was missing. Here are the steps for using the Silver Searcher backend:

  • Invoke counsel-ag
  • After you've found the search results, run C-c C-o (ivy-occur)
  • Toggle the edit flag of the buffer to enter wgrep mode: hit C-x C-q
  • Once done with the edits, hit C-c C-c to commit your changes

This also works with other tools like ripgrep; use the associated counsel-* command. (In the case of ripgrep, use counsel-rg.)

Ashton Wiersdorf
  • 349
  • 1
  • 11