a few notes on notation, before I get going:

the C- or M- parts of these listings stand for pressing the Control key (Ctrl) or Meta key1(respectively), as the same time as the second part of the listing. So a command like C-x means, "push the control key and 'x' at the same time", and M-x means, "push the meta key and 'x' at the same time.

sequences of these, like "C-x C-c", for example mean, "perform the first sequence (C-x), then the second sequence (C-c)". You'll notice that if you perform the first key sequence and wait for a second, that it shows up in the modeline, with a dash (-) following it; this is emacs' way of telling you that you need to type something else before it will go on.

anyway, ONWARD:

in order of them popping into my head:

  • C-x C-c : save-buffers-kill-emacs (quit emacs. Wait! Why would you want to do that?

  • )
  • C-_ : undo. (we all make mistakes, eh?)

  • C-+ : redo. (yes, I know that "redo.el" is not part of any standard emacs distribution, but, by jove, it should be! Anyway, once you get that, bind "C-+" to "redo", and the world will start to make sense, once more)

  • C-g : keyboard-quit. (if you are doing something interactive (in the minibuffer or otherwise), this will kick out out of that and back to normal editing. I normally hit this several times, for good measure...)

  • C-s and C-r : isearch-forward and isearch-backward (press once to start searching for text, as you type; if you want to find the next match, push C-s or C-r again)

  • M-C-s and M-C-r: isearch-forward-regexp and isearch-backward-regexp (like their non-regexped siblings, except that emacs searches for a regular expression as you type it; quite trippy, but useful, nonetheless)

  • M-x : execute-extended-command (ack! How could I have forgotten this one until now!? For interactive functions which have no keyboard shortcut, this is your ticket to using them.)

  • C-x r t : string-rectangle (One of my favorites from the "rectangle" series of functions. This one lets you replace a rectangular region of text with a given string on every line of the region. It's sort of hard you explain; try it, you'll like it!)

  • M-C-/ : indent-region (indent the portions of the text that you have highlighted.. very usful when modifying large chunks of code; it avoids you pushing tab on every line)

  • C-k : kill-line (better when the variable kill-whole-line is non-nil; it cuts an entire line of text (including the newline) if the cursor is at the beginning of the line, or all the text up to the end of the line, otherwise.)

  • C-l : recenter (centers your view of the buffer around the cursor; nice to use when you are paging down through text, and come across something important to read.)

  • C-z : iconify-or-deiconify-frame, if you're in a GUI environment, suspend-emacs, if you are in a terminal. (STAY AWAY from this one, unless you are running emacs in a terminal; in GUI-mode, this only serves an annoyance, and one of these days I am going to get around to rebinding it to something useful... except that if I am in a terminal, it's vital. ARGH!)

  • C-h k, C-h f, and C-h v : describe-key, describe-function, and describe-variable, respectively. (need documentation on what something is/does/whatever? This is how I usually learn about emacs' functions, before reading the source code.)

  • C-h b : describe-bindings (this will give you a list of all the nifty key-bindings that the author of whatever programming/editing/interacting mode thought there should be; you can discover a lot, by reading through the list!)

  • C-q : quoted-insert (instead of executing the key command for the next key pressed after this, the actual key that you pressed is inserted. So C-q ESC would result in "^[ (the escape character) being inserted.)

  • C-w and C-y : kill-region and yank (like Cut and Paste, in more "normal" environments.. It's too bad that copy-region-as-kill isn't bound to a key by default; I find it quite useful)

  • C-u : universal-argument (for the most part, useless. Occasionally you will want to paste a bunch of times, more often you will want to execute a macro repeatedly, or whatever, but most of the time it just sits there. My favorite use of it is with comment-region); when given a prefix-argument, it is effectively uncomment-region.)

  • C-x C-f : find-file (AAAH!!! It is amazing to me, how many emacs users still use their mouse to do a File/Open, instead of this, which is much faster..)

  • C-x h : mark-whole-buffer (like "Select All" in many word processors; I use it a lot when I want to edit something in emacs, but use it somewhere else.. E2 writeups come to mind, here.)

  • C-x C-s : save-buffer (The same idea as with C-x C-f: Why do File/Save, when you can do this? Bewildering...)

  • C-h a: apropos-command (VERY useful! This is like the apropos command in Unix; if you want to find an interactive function that you think should exist, this lets you search for it. Thanks to Korny for pointing out my having left it out...)
  • C-x ( (along with C-x ) and C-x e of course): start-kbd-macro, end-kbd-macro, and call-last-kbd-macro, respectively. (If you need to do some repetitive operation on text, or files, or whatever else emacs can manipulate, this will help you out immensely.)

that's all I can think of, for now... /msg me if you don't want to add a node, but think there's another useful key command that everyone should know

1 The Meta key is not found on all keyboards. Many "real" Unix machines actually have a key labelled "meta", or with a diamond, or some such thing.. On a "normal" PC (and on those more esoteric Unix boxes), the Escape key acts as the meta key, as does the Alt key. Although you can have emacs treat Alt as being different than Meta, but I find that to be confusing, so I just avoid using it at all..

The only key commands an Emacs user must memorize is:

:wq or ZZ

Probably preceded by pressing ESCAPE, to get out of vi's input mode.

Once in (X)Emacs, you're inside a "self-documenting editor", so you don't need to know any of the commands. If you find yourself in the editor for the first time ever, just read the splash screen; it will tell you all you need to know. C-h t is very handy, if you're too lazy to read even that.

Log in or register to write something here or to contact authors.