I use C-s to search for a string. All matches are highlighted. Then I would like to scroll down by C-v, but all matches disappear.
I know keeping C-s will move to the next match, but it is too slow. How shall I do then? Thanks.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityAfter scrolling down, hit C-s
twice. That will restart the search, using the search string from the previous time you used C-s
.
isearch-allow-scroll
or search-exit-option
.
Oct 31, 2016 at 13:48
@legosia's answer is the usual one, and probably what you want. But be aware that there is an alternative Isearch behavior that lets you scroll the buffer being searched without exiting Isearch.
If you set (or bind) option isearch-allow-scroll
to non-nil then you can scroll without exiting Isearch, as long as the current match is still on screen.
This has the advantage that you can continue to see the set of matches highlighted. The current context is maintained while you scroll.
Few are aware of this option, and probably fewer still make use of it.
Some more info about isearch-allow-scroll
-
In addition to allowing scrolling, non-nil isearch-allow-scroll
also has the effect of non-nil option isearch-allow-prefix
(available starting with Emacs 24.4). That is, it lets you pass a prefix argument to a command that is bound to a key in isearch-mode-map
. So to use a prefix argument you must set either isearch-allow-scroll
or isearch-allow-prefix
(if available) to non-nil. Otherwise, a prefix arg during Isearch exits Isearch.
Some Isearch enhancements, such as Isearch+, bind keys that let you make use of a prefix argument for various actions during Isearch.
C-v
, and then hitC-s C-s
to resume the search, does that do what you want?C-s C-s
do actually?C-s
invocation.