CUA-mode is a minor-mode that enables the use of Ctrl-X/C/V
for cut/copy/paste, as is customary in many computer programs. Of course, it's a bit different in emacs, as it predates CUA and all of those programs. With esp. Ctrl-X
(C-x
) being in heavy use as a prefix-key already, it's unlikely to change.
CUA-mode has a clever trick to solve that problem – C-x
for cut only works when a selection is active, and when no other key is pressed shortly. Otherwise, C-x
behaves as usual. This works quite nicely, but personally, I don't use it, as I already have the Emacs key bindings in my muscle memory. Still, it can be useful for people migrating from other CUA-based editors. See e.g. CuaMode for more information.
However, apart from the C-x
-trick, CUA also has some nice functionality for rectangular selections. These are sometimes quite useful, and during emacs-fu's prehistory there was already an article about it. The method there works, but with CUA, it is much easier.
So, let's turn it on; put the following in your .emacs
:
(setq cua-enable-cua-keys nil) ;; only for rectangles
(cua-mode t)
Now, just put your cursor anywhere, and press C-RET
(Ctrl + Enter). You have now started a rectangular selection! There rest is pretty straightforward, you can cut, copy and paste with the normal Emacs key bindings..
I could go into more detail, but the best way is to see it in action in this wonderful screen cast by Mark Mansour. I especially like the way you can add numbered lists.
No comments:
Post a Comment