Next: Multiple Windows, Buffers, and
Up: The Woodnotes Guide to
Previous: Searching and Replacing
Contents
In the Larry/Moe example above, the % tells
the search command to search the entire document. But searching and replacing
is one of the few times a writer might be interested in limiting the effect of
a command to a certain range of lines rather than to the entire document. Use visual mode to select a certain
part of your document, and then limiting the search and replace to that range
with * instead of %. Figure 10 shows the other
options at your disposal.
Figure 10:
Ranges
|
Here are two examples:
- .,$s/German/French/g
- ``From the cursor's
current position to the end of the document, replace German by French.''
- *s/Zune/iPod/gc
- ``Within the visual area, change all occurrences of Zune with iPod, and confirm each replacement.''
Randall Wood
2009-08-04