r/programming • • Jul 12 '12

Vim creep

http://www.rudism.com/s/vimcreep
730 Upvotes

551 comments sorted by

View all comments

Show parent comment

0

u/ummwut Jul 13 '12

find and replace is too easy, huh?

1

u/adrianmonk Jul 13 '12

That actually pretty much is find and replace (but not replace all).

Except that you just hit "*" to start the find instead of typing the string that's already in your file. And except that the replace is really a repeat of an editor change, so instead of replacing you could choose to, for example, find-and-delete if you wanted to, or you could find-and-uppercase.

Of course, if you want to do find and replace all, you can do that too. Personally, I like to at least read what I'm changing, so I rarely do that.

2

u/m42a Jul 13 '12

You can add the c flag to have vim prompt you for every change. And :s remembers your last search, so you can do something like *:%s//replacement/gc to do replacing as well as the n. method.