some handy key bindings






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 x gives you xxxxxxxxxxxxxxxxxxxxxxxxxxx; and, believe it or not,
    works also with different characters and numbers;


  • M-m jumps 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 k followed by some key or key combination tells you what it does, C-h m describes the currently active modes, with their key bindings;


  • C-h f documents the current function, C-h v does the same for
    variables. C-h a gives 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 a accepts regular expressions);


  • C-x C-o will delete all the empty lines around your current cursor
    position, except for one;


  • M-q re-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 RET in 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 TAB and I get YEN SIGN, which RET will 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 *alpha or TAB the
    empty string, and search in the results buffer, but that's rather slow);


  • C-h l shows 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.


No comments:

Post a Comment

Followers

Popular Posts