Next: MatchBracket, Previous: ReplaceAll, Up: Search Commands
Syntax: RepeatLast [
times]
Abbreviation: RL
repeats for the given number of times the last find or replace operation
(with replace we mean here a single replace, even if the last Replace
operation ended with a global substitution).
RepeatLast
is especially useful for researching a given number of times, or
replacing something a given number of times. The standard technique for
accomplishing this is:
Find
(or FindRegExp
) the string you are interested in;
ReplaceOnce
with
the replacement string you are interested in;
RepeatLast
n-1
command, where n is the
number of occurrences you wanted to skip over, or replace.
The important thing about this sequence of actions is that it will
work this way even in a macro. The Replace
command cannot be used
in a macro unless you really want to interact with ne
during the
macro execution. Avoiding interaction during macros is the primary
reason the commands ReplaceAll
and ReplaceOnce
are
provided.