Next: Using Named Registers
Up: Selecting Text, Cutting and
Previous: Selecting Text, Cutting and
Contents
There
are easy ways and hard ways to select text, but they are both useful and worth
getting to know. The easiest way is called Visual Mode. Trigger it by
pressing v or V. A lower case v starts highlighting text one
letter at a time; this is good when you want to edit part of a sentence. A
capital V starts highlighting text one line at a time. When you've
selected the text, hit d to delete it (or ``cut'' it, since it winds
up in a buffer), or y to yank (``copy'') it. Then navigate to where
you want and hit p to place (``paste'') it. Normally, the cursor
remains at the top of what you have just pasted, which gives you a chance to
scroll down through the next text. But if you want to paste and go,
gp and gP paste and then reposition the cursor at the bottom
of the next text.
You can also use t and f to advance the cursor until a point just before or
right on the letter you are searching for. I frequently start visual mode with
v and then advance up to the first comma and delete it. That looks
like this: vf,d. That is, ``start visual mode, advance to the comma,
delete.'' Otherwise, use the a key plus w, s, p to add a
word, sentence, or paragraph. But I just as often use the regular motion
commands, and they work fine.
Figure 8:
Visual Mode Selection Commands
|
The more complicated way is to use the motion commands alone to select areas.
For example, if you want to copy the entire sentence you just wrote, you could
issue y( (that is, ``yank to the beginning of the sentence''). You'll
get no visual feedback for this operation, but the text will be yanked and
ready to place elsewhere. As an author, though, this is a fast way to keep
your hands on the keyboard. If you don't like what you just wrote, a simple
d( will remove your last sentence, d5b will remove the last 5
words, dTZ will delete back until the last occurrence of a capital Z,
and so on.
Next: Using Named Registers
Up: Selecting Text, Cutting and
Previous: Selecting Text, Cutting and
Contents
Randall Wood
2009-08-04