The most common case I use it with is reformatting code. For example, I have a lot of code that looks like this:
enum class HotKeyTriggerFireType {
kPressed,
kWhileDown,
kReleased,
kTapped,
};
#define kHotKeyTriggerFireNamesArray {CFSTR("Pressed"), CFSTR("WhileDown"), CFSTR("Released"), CFSTR("Tapped"), NULL}
Converting from the first format into the second format can be done like this.
Paste in a copy of the first format:
kPressed,
kWhileDown,
kReleased,
kTapped,
Put the cursor on the start of the first line, and then start recording and type the sequence:
CFSTR(“Pressed”),
Option-Shift-Right, Option-Shift-Left, CFSTR("
, Forward Delete, Option-Right, Command-Shift-Right, "),
, Forward Delete
Stop Recording, and then press the play back key three times.
For three or four things this is borderline. For ten, this is a great method. For 100, maybe figuring out a regular expression Search & Replace is a better solution.
And, of course, if you do this regularly, then creating a specific macro for this specific case is a good idea.