Previous: Rectangles, Up: Killing
The command M-x cua-mode sets up key bindings that are compatible with the Common User Access (CUA) system used in many other applications.
When CUA mode is enabled, the keys C-x, C-c, C-v,
and C-z invoke commands that cut (kill), copy, paste (yank), and
undo respectively. The C-x and C-c keys perform cut and
copy only if the region is active. Otherwise, they still act as
prefix keys, so that standard Emacs commands like C-x C-c still
work. Note that this means the variable
has no effect for C-x and C-c (see Using Region).
To enter an Emacs command like C-x C-f while the mark is active, use one of the following methods: either hold Shift together with the prefix key, e.g., S-C-x C-f, or quickly type the prefix key twice, e.g., C-x C-x C-f.
To disable the overriding of standard Emacs binding by CUA mode,
while retaining the other features of CUA mode described below, set
CUA mode by default activates Delete-Selection mode (see Mouse Commands)
so that typed text replaces the active region. To use CUA without this
behavior, set the variable
CUA mode provides enhanced rectangle support with visible rectangle highlighting. Use C-<RET> to start a rectangle, extend it using the movement commands, and cut or copy it using C-x or C-c. <RET> moves the cursor to the next (clockwise) corner of the rectangle, so you can easily expand it in any direction. Normal text you type is inserted to the left or right of each line in the rectangle (on the same side as the cursor).
You can use this rectangle support without activating CUA by calling the
cua-rectangle-mark-mode command. There's also the standard command
rectangle-mark-mode, see Rectangles.
With CUA you can easily copy text and rectangles into and out of
registers by providing a one-digit numeric prefix to the kill, copy,
and yank commands, e.g., C-1 C-c copies the region into register
1, and C-2 C-v yanks the contents of register
CUA mode also has a global mark feature which allows easy moving and copying of text between buffers. Use C-S-<SPC> to toggle the global mark on and off. When the global mark is on, all text that you kill or copy is automatically inserted at the global mark, and text you type is inserted at the global mark rather than at the current position.
For example, to copy words from various buffers into a word list in a given buffer, set the global mark in the target buffer, then navigate to each of the words you want in the list, mark it (e.g., with S-M-f), copy it to the list with C-c or M-w, and insert a newline after the word in the target list by pressing <RET>.