Next: Searching and Replacing
Up: The Basics
Previous: Selecting Text (``Regions'')
Contents
Cutting and Pasting (Killing and
Yanking)
This is the most obvious example of how emacs doesn't follow
naming conventions used by most other software. Killing and Yanking,
once you get used to the new vocabulary, does what you'd expect it to,
but emacs provides some other tricks that are useful to writers.
First of all, emacs remembers more than one thing cut (``killed'') and
keeps them in a list called the kill ring. You can later paste
(``yank'') not just the most recent thing killed but previous things as
well. Simply hit C-w to ``kill'' something (i.e. ``cut'' it). To ``yank''
it, hit C-y (i.e. ``paste''). To copy something to the kill ring
(i.e. ``copy''), use the Alt key instead of the Control key, that is
M-w. The basics are shown in Figures 7 and
8.
Figure 7:
Killing (cutting)
|
Let's look for a moment at how the kill ring works. Imagine an
immense list of everything you've killed during this session that you
can cycle through. When you ``yank'' some text, the most recent item is
what you get. But if you immediately hit M-y, that text is replaced
with the previous item. Hit M-y again to replace that with the item
previous to that, and so on until you get what you want. It's called
a kill ring because you cycle through all the items, eventually
returning to the most recent item killed.
Figure 8:
Killing and Yanking
|
Lastly, you can also kill things selectively - a word here, a
sentence there - and accumulate them as you go, kind of like a
selective harvest of your text. You may not use these tricks
frequently, but they're highly convenient when you need them:
Figure 9:
Accumulating Text in Buffers
|
Next: Searching and Replacing
Up: The Basics
Previous: Selecting Text (``Regions'')
Contents
Randall Wood
2011-03-31