12 November 2010

Obscure and often used emacs key bindings

Nowadays I juggle programming Clojure in emacs on Ubuntu, and C++ in Visual Studio on Windows.  Despite using what emacs key bindings I can in Visual Studio, I still have to keep track of two very different text editors.

So I'm going to start collecting some emacs key bindings I often use here that are, well, obscure:

Formatting text:

C-M-\ for applying auto-indenting on a marked region
M-q for applying auto-hard-line-breaking on a marked region

Using registers:

C-x r s n for copying text in marked region into register n, for n between 0 - 9 (and apparently other single ascii char, but I'm not sure).
C-x r r n for copying text in marked rectangular region into register n.
C-x r i n for inserting text from register n to current point (be it rectangular or otherwise).

C-x r SPC n for copying the current point/location in the file into register n.
C-x r j n for jumping to the point/location in the file saved into register n.

(See also Registers and Bookmarks.)

In paredit mode:

C-u del or C-u C-d to force the deletion of a character (without paren matching getting in the way)
C-q x for arbitrary character x will force insert the character x (without paren matching getting in the way)

That's all for now.

2 comments:

Ray Vega said...

Since you use both Emacs and Visual Studio, have you tried Emacs keybindings in VS using either the VS Emacs scheme or XKeymacs?

mlsci said...

Yes, I do use the VS Emacs scheme. But VS doesn't have Paredit, which I use in Emacs to make programming in lisp sane.

Paredit has some initially quirky keybindings that I have to remember, hence this post.

XKeymacs looks good, but apparently doesn't completely work on Win 7 64 bit. Thanks for letting me know of it though. I'll have to keep an eye on that one.