5

I've use helm and ivy with swiper the search is great but I like to be able to keep search results in a buffer, navigate and edit my code and switch back to my search results buffer.

2 Answers 2

4

To do this with Ivy, press C-c C-o (ivy-occur).

If the buffer contents have changed after the search, you can refresh the occur buffer with g.

2

Someone else may let you know how you can save a set of search results with Helm or Ivy and return to it later, after some editing.

But if you are not set on using only Helm or Ivy, you can do what you want in other ways:

  • Use command occur or multi-occur - or grep to search. These are generally line-oriented, meaning that they search within each line - a line is the search context.

  • Use Icicles -

    Icicles search is similar to Swiper (Ivy search) or helm-swoop. (Icicles search was doing Swiper 10 years before Swiper was introduced - 2005 vs 2015.)

    Like search with Helm or Ivy, Icicles search presents search hits as a set of completion candidates. And you can incrementally change the set of search hits - it instantly reflects your current minibuffer input. And you can progressively narrow the search (match this and that and that but not that and not this...).

    With Icicles you can easily save any set of completion candidates, either temporarily, across an Emacs session, or persistently (in a disk file), and you can retrieve them anytime, including (for a persistent saved set) in a future Emacs session.

    So yes, you can go back and forth between editing and searching your source code. You don't lose a set of search hits just because you stop searching temporarily to edit the code you were searching.

1
  • Alt+X occur works for me. Thanks.
    – vineeshvs
    Jun 2, 2021 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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