oftjdg
Last Updated: February 25, 2016
·
397
· bonsaiben

Surgical Replace

vim

1) search with / like normal
2) make your change, but in one edit so that it's repeatable
3) find next with "n" and replace as necessary with "."

It's easier than %s/a/b/c and gives you surgical control over what to replace.

Common examples I use:

/true[CR]cefalse[ESC]n.nnn.
/ClassName[CR]ceNewClassName[ESC]n.n.nn.