Emacs offers many handy key bindings; every now and then I come across a new one, which has been hiding there somewhere for a decade or more… Here are some of my favorites – I'm listing those that are (a) often useful, (b) might not be known by everyone already (c) don't require any external packages or setup.
M-27 xgives you
xxxxxxxxxxxxxxxxxxxxxxxxxxx; and, believe it or not, works also with different characters and numbers;
M-mjumps to the first non-whitespace character on the current line;
M-^joins two lines into one – like vi(m)'s
:join, except that point must be on the second line, not the first;
M-/auto-completes based on words in all your buffers; there are more powerful alternatives, but this one does not require any setup;
C-h kfollowed by some key or key combination tells you what it does,
C-h mdescribes the currently active modes, with their key bindings;
C-h fdocuments the current function,
C-h vdoes the same for variables.
C-h agives you information about commands - for example to get
date-related commands, press
C-h a date. This will, however, also get you commands related to
update; instead, you can use
C-h a \bdate(because
C-h aaccepts regular expressions);
C-x C-owill delete all the empty lines around your current cursor position, except for one;
M-qre-aligns the current paragraph; I use it all the time when writing e-mails etc. (you might want to check out filladapt for a version that gives you a bit more smartness with indentations, lists etc.);
C-x 8 RETin a recent emacs version gives you an auto-completable list of special characters to insert. So if I need, say, the Yen-character, I type
C-x 8 RET ye TABand I get
YEN SIGN, which
RETwill then insert: ¥. Note that the completion only works on the start of the character name, so if you'd want to include the α-character, you'd need to know that its UCS-name is
GREEK SMALL LETTER ALPHA… (you can try
*alphaor TAB the empty string, and search in the results buffer, but that's rather slow);
C-h lshows your last 300 key presses ('lossage'). Interesting to see, and it might be useful when defining keyboard macros.
What are your favorites? Please share them in the comments.