Cua-mode is part of GnuEmacs versions 22.1.1 and later (at least).
Cua-mode allows one to use
‘C-x’ to paste, copy, and cut the region. Since this conflicts with very important keybindings in Emacs, these CUA bindings are only active when the mark is active. The package does a whole lot more, too:
‘C-z’ to undo, Shift-movement to select, and it includes support for rectangular regions (
‘C-RET’ and arrow keys instead of using the `C-x r …’ keys) and registers (instead of using the register commands), and it uses `<tab>’ and `S-<tab>’ to indent and outdent the region. As you can see, it is very powerful!
Note: If region is not active – no visible selection – then
‘C-x’ works as it as it does normally in Emacs (without cua-mode).
On the other hand if the region is active you can use C-S-x (or two rapid C-x C-x) instead C-x to do what C-x normally does in Emacs. The same goes for the other CUA keys.
More information on Cua-mode is in the Gnu-Emacs manual CUA Bindings.
Note: If you have an Emacs version which does not have it, you must obtain cua.el (see Kim Storm’s page http://www.cua.dk/). To see if Cua is built into your Emacs try
M-x cua-mode. Cua-mode seems not to be part of X-Emacs and at least for recent XEmacs-versions cua-mode.el seems to be broken – see Note 4.
For GNU Emacs versions above 22.1:
~/.emacs(the last three are optional):
(cua-mode t) (setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands (transient-mark-mode 1) ;; No region when it is not highlighted (setq cua-keep-region-after-copy t) ;; Standard Windows behaviour
When cua.el is used:
(require 'cua) (CUA-mode t)
If you like the rectangle support, global mark mode, and other features, but prefer the standard Emacs keys, add:
or, if using cua.el, add
(CUA-mode 'emacs) instead of
Note 0. There are fixes for CuaModeTerminalProblems.
Note 1. An alternative to cua-mode might be CuaLightMode.
Note 2. See CopyAndPaste for a discussion on Cua-mode and related subjects.
Note 3. See CuaAndIsoTransl for a comment on the order or cua-mode and iso-transl in .emacs.
Note 4. A much more primitive cua-mode.el for XEmacs is also available from Kim Strom’s site (www.cua.dk), written by SL Baur, but it is currently broken. see http://groups.google.com/groups?q=cua-mode+%2B+xemacs&hl=en&rnum=4&selm=88h0hm%24qtb%241%40pheidippides.axion.bt.co.uk
;; shift + click select region (define-key global-map (kbd "<S-down-mouse-1>") 'ignore) ; turn off font dialog (define-key global-map (kbd "<S-mouse-1>") 'mouse-set-point) (put 'mouse-set-point 'CUA 'move)