next up previous contents
Next: Using Ranges Up: The Woodnotes Guide to Previous: Using Named Registers   Contents

Searching and Replacing

Let's start with the most common one as an example. Suppose you've written a story and now you want to change one of the character's names from Larry to Moe. It's as simple as %s/Larry/Moe/g which says ``For the entire document, change all occurrences of Larry to Moe.'' The percent sign is the range identifier that indicates the search should take place over the entire document. You can't use motion commands here, but you can use line numbers (which is not that useful for authors), so :0,.s/hoo/ha/g will replace hoo with ha from line 0 to the present line. You can also append c for ``confirm each replacement.''

Randall Wood 2009-08-04