I want to have a similar tool in Emacs as the following in Vim
:g/search/
to get a list of matches.
How can you get a list of matches in Emacs?
I want to have a similar tool in Emacs as the following in Vim
:g/search/
to get a list of matches.
How can you get a list of matches in Emacs?
My usual workflow is not to get a list and choose (don't know how to do that), but to use the incremental search:
C-s <search target>
gets the fist match after the point. If you don't like it another C-s
gets the next one. Continue until you're happy (you'll need an extra C-s
to wrap around from the and of the buffer). New enough emacsen can also highlight all the matches that are visible.
As noted in the comments by Török Gábor, this is the typical keybinding of isearch-forward
. In the event that your bindings are different, you need to modify the prescribed procedure.
In addition to M-x occurr
check also M-x grep. This works in several files at once.