RepeatLast - ne's manual
Description: ne's manual

Next: MatchBracket, Previous: ReplaceAll, Up: Search Commands

#### 4.5.6 RepeatLast

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:

1. `Find` (or `FindRegExp`) the string you are interested in;
2. if you want to repeat a replace operation, `ReplaceOnce` with the replacement string you are interested in;
3. now issue a `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.