My Emacs Cheatsheet

(c) 2004 by Michael Wells

Useful Commands for Memory

Not useful, if you have not used Emacs or read the Emacs tutorial (Ctrl-h t), try (F10) for the menu-bar or (Ctrl-h ?) for help.
FILE COMMANDS
New, Open file
C-x C-f FILENAME (find-file)
C-x i FILENAME (insert-file)
C-x 4 C-f FILENAME
  (find-file-other-window)
C-x 4 b BUFFER
  (switch-to-buffer-other-window)
Save file
C-x C-s (save-buffer)
C-x C-w FILENAME (write-file)
Print
F10 f p Print Buffer
Close file
C-x k BUFFER (kill-buffer)
C-x 4 0 (kill-buffer-and-window)
F10 f c (kill-this-buffer)
Exit
C-x C-c (save-buffers-kill-emacs)
M-x kill-emacs RET (kill-emacs)
BUFFERS, WINDOWS, & FRAMES
Buffers
C-x C-b (list-buffers)
C-x b BUFFER (switch-to-buffer)
C-x s (save-some-buffers)
Windows
C-x 0 (delete-window)
C-x 1 (delete-other-windows)
C-x 2 (split-window-vertically)
(C-u #) C-x ^ (enlarge-window)
C-x 3 (split-window-horizontally)
F2 2 (2C-two-columns)
F2 1 (2c-merge)
F2 } (2c-enlarge-window-horizontally)
F2 { (2c-shrink-window-horizontally)
Frames for windows
C-x 5 2 (make-frame-commnad)
C-x 5 0 (delete-frame)
MENU BAR & HELP COMMANDS
F10 <menu-bar> hotkey
F1 or C-h ? shows help menu
C-h a APROPOS (apropos-command)
C-h b (describe-bindings) list keys
C-h c KEY (describe-key-briefly)
C-h f FUNCTION (describe-function)
C-h i (info) infotex & Emacs manual
C-h k KEY (describe-key)
C-h C-k KEY (info-goto-emacs-key)
C-h t (help-with-tutorial)
C-h w Definition (where-is) find keys
C-h F (view-emacs-FAQ)
C-h h (view-hello-file)
F10 h r Read the Emacs Manual
MOVEMENT
Cursors
C-x o put cursor in (other-window)
C-b, LtArrow (backward-char)
C-f, RtArrow (forward-char)
C-p, UpArrow (previous-line)
C-n, DnArrow (next-line)
M-b, (backward-word)
M-f, (forward-word)
C-a, Home (beginning-of-line)
C-e, End (end-of-line)
M-a (backward-sentence)
M-e (forward-sentence)
C-l (recenter)
C-u 0 C-l top of screen
C-v, PgDown (scroll-up)
M-v, PgUp (scroll-down)
C-M-v (scroll-other-window)
M-<, C-Home (beginning-of-buffer)
M->, C-End (end-of-buffer)
Auto-repeat
C-u #, M-# (universal-argument)
- can precede most commands
EDITING COMMANDS
Select
C-SPC, C-@ (set-mark-command)
- marks start of region, for copy & delete
M-x transient-mark-mode toggle highlight
C-x h (mark-whole-buffer)
Copy
C-k C-y kills & yanks to end of line
Next two start from (C-SPC) a select mark
C-w C-y kills & yanks marked regions
M-w (kill-ring-save) kill region and yank
Delete or Cut (Kill=Cut)
Backspace (delete-backward-char)
C-d, Delete (delete-char)
M-Backspace (backward-kill-word)
M-d (kill-word), can append
C-k (kill-line) from cursor, appends
M-k (kill-sentence) from cursor, appends
C-w (kill-region) between point and mark
- preceded by C-SPC mark
Paste (Yank)
C-y (yank) reinsert last killed text
Undo
C-x u, C-_ (undo) repeatable with history
ESC ESC ESC (keyboard-escape-quit)
C-g (keyboard-quit)
C-] (abort-recursive-edit)
C-q sometimes unfreezes a frozen screen
OTHER COMMANDS
Find incremental
C-s (isearch-forward) repeat-next
C-r (isearch-backward) repeat-next
Replace
M-x replace-string From-Str To-Str
- to buffer-end unless (C-SPC) marked
Transpose
C-t (transpose-chars) previous 2 chars
M-t (transpose-words) prev. & next
Modes
C-h m (describe-mode)
M-x [fundamental-mode | text-mode |
  human-language-mode | html-mode]
C-c C-s (html-autoview-mode) toggle
- see in broswer with C-x C-s, C-c C-v
Misc.
F10 o s Syntax highlighting
F10 t 1, M-x compare-windows
F10 t 0 Spell checking
F10 t s Search files (grep)
C-z Minimize or goto prompt
    fg to restore from command prompt