How to "undo" `cmd-d`?


I am editing a function. I want to rename the variable foo to bar in it. So I go to the beginning of the function and hit cmd-d. Good. So I type cmd-d again. Ah! It highlights the second occurrence. Good. So I keep hitting cmd-d.

Oh no! I just overshot! Now it marked a foo that is outside the current function!

What do I do to “undo” the last cmd-d?


Try text pastry


I approve of this illustrative method of replication instructions.


It works very nicely. Thanks a bunch!


Just for reference: this is built-in functionality now. Press cmd-u (macOS) or ctrl-u (other platforms).