A Vim Guide for Advanced Users
The article mentions ”gn” in passing, but it doesn’t give it enough credit: this is an enormously useful motion, almost more useful on its own than the rest of the article.<p>The thing that makes it golden is that it is a motion, and thus combined with a command, it is repeatable! So, like:<p>1. Search for something (either using / or *).<p>2. Type ”cgn” in Normal mode (i.e. change next search match) and replace what you searched for with whatever<p>3. Hammer on ”.” (i.e. repeat last command) to replace other matches.<p>This replaces, like, 97% of uses of :s and is a much more convenient way to do search/replace, especially if you use * to search for the word under the cursor. It’s the bee’s knees!