CUA Selection Mode

Many Emacs users like CUA mode. That makes a certain amount of sense because then copy/cut/paste work in Emacs the same way it does in almost every other application. I, however, am in the camp of the traditionalists and prefer the default Emacs way. I never get confused when I'm cutting and pasting in other applications and I spend most of my time in Emacs anyway. Not everyone agrees. Xah Lee, for example, is adamant about modernizing the Emacs interface and he always mentions turning on CUA mode first when he writes about it.

That said, one thing I do like about CUA mode is its handling of rectangles. It's far superior to the default behavior. It's not better enough to make me turn on CUA mode but it turns out that you can get the rectangle features without the 【Ctrl+x】/ 【Ctrl+c】/ 【Ctrl+v】/ 【Ctrl+z】 bindings. To do that just add

(cua-selection-mode 1)

to your .emacs or init.el file. Nirvana: superior rectangle handling but with the standard kill/copy/yank/undo interface.

Once you've enabled the mode, you set a rectangle by typing【Ctrl+Return】 and using the normal【Ctrl】 movement keys. Most of the【Meta】 movement keys are remapped to perform the various rectangle functions (you can see what they are with 【Ctrl+?】). You can cancel the rectangle with another【Ctrl+Return】. One of the nice things about this interface is that you see the actual rectangle instead of a virtual rectangle like you do with the standard interface.

You can kill and yank the rectangle with 【Ctrl+w】 and 【Ctrl+y】 as usual. In general, this interface is easier to use and requires fewer keystrokes to perform a given task. As the documentation says, the only new keystroke you need to learn is 【Ctrl+Return】.

This entry was posted in General and tagged . Bookmark the permalink.
  • This has also lots of neat side-features. I especially love this one: try to do C-1 C-w. Now, the stuff you just cut is in your register 1! And you can place it back with C-1 C-y. You can use all the 1-9 + 0 prefixes for this. Super handy when you need to copy/paste 2 or 3 lines in various places. Without prefix, it goes to kill-ring as usual.