[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
17. CUA Bindings
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. C-x means cut (kill), C-c copy, C-v
paste (yank), and C-z undo. Standard Emacs commands like
C-x C-c still work, because C-x and C-c only take
effect when the mark is active (and the region is highlighted).
However, if you don't want to override these bindings in Emacs at all,
set cua-enable-cua-keys
to nil
.
In CUA mode, using Shift together with the movement keys activates and highlights the region over which they move. The standard (unshifted) movement keys deactivate the mark, and typed text replaces the active region as in Delete-Selection mode (see section Mouse Commands for Editing).
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.
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).
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 2
.
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>.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |