Emacs' Shortcuts





The following list of commands for Emacs is taken directly from "Quick Reference" page in O'Reilly's Learning GNU Emacs. This is provided as a resource only.



Starting, Stopping, and Undoing

 Command            Action


 emacs                    start Emacs from the shell prompt

 emacs filename    Start Emacs and edit specified file

 C-x C-f                    Find a file

 C-x C-s                   Save a file

 C-x s                       Save all files

 C-x C-c                   Exit Emacs

 C-g                         Stop command in progress

 C-x u                       Undo

 C-z                          Suspend Emacs

 C-x b                       Move to another buffer

 C-x k                       Kill Buffer

ESC '                      Access menus from a text-based terminal



Moving Around

 Command                Action


 C-f                               Forward character (right)

 C-b                              Backward character (left)

 C-p                              Previous line (up)

 C-n                              Next line (down)

 C-v or PageUp          Forward one screen

 ESC v or Pg. Down   Backward one screen

 ESC < or Home         Beginning of file

ESC > or End            End of file

ESC f                          Forward word

ESC b                         Backward word

C-a                              Begining of Line

C-e                              End of line

Cutting and Pasting

 Command                Action


 C-d                             Delete character under cursor

 DEL                            Delete previous character

 ESC d                        Delete next word

 ESC DEL                  Delete previous word

 C-k                             Delete from cursor to end of line

 C- ,C-SPACE           Mark the Beginning (or end) of a region

 C-w                           Cut region

 ESC w, C-Insert      Copy region

 C-y or S-Insert          Paste

 ESC y                       After C-y, paste previous

 INSERT                    Togle overwrite mode



Search and Replace

 Command                Action


 C-s                              Incremenatal search forward

 C-r                               Incremenatal search backward

 C-s C-s                       Repeat last search

 RETURN                    Exit Search

 ESC %                       Query-replace

 SPACE or y               Replace

 DEL or n                     Don't replace

 !                                   Replace all and don't ask



Windows

 Command                Action


 C-x 2                          Divide current window horizonatally

 C-x o                          Move to other window

 C-x 0                          Delete the current window

 C-x 1                          Delete all windows but this one

 ESC C-v                    Scroll other window

 C-x 4 f                        Find file in other window



Shortcuts

 Command                Action


 C-x ESC ESC           Repeat last complex command

 ESC p                        Display previous input

 ESC n                        Display next input (after ESC p)

 C-t                              Transpose two letters

 ESC t                         Transpose two words

 ESC u                        Uppercase word

 ESC l                          Lowercase word

 ESC c                        Capitalize first letter of word

 C-x r m                       Set a bookmark for this file

 C-x r b                        Jump to a bookmark

 C-x r l                           List bookmarks

 ESC ;                          Insert a comment marker



Starting Tools

 Command                Action


 ESC x                        Shell Start shell buffer

 C-x d                          Start Dired, the directory editor

 C-x m                         Write a mail message

 C-c C-c                      Send mail message

 ESC x rmail               Read mail

 h                                  Display RMAIL summary list

 C-x C-b                      Display buffer list

 ESC x gnus               Start Gnus newsreader

 ESC x w3                  Start W3 browser (if installed)

 ESC x telnet              Open telnet connection



Moving around Gnus, RMAIL, Buffer List, Dired, & W3

 Command                Action


 n                                  Move to next item

 p                                  Move to previous item

 SPACE                      Scroll test buffer or move to next item

 d                                  Mark item for deletion

 x                                  Delete marked items

 RETURN                    Select item

 q                                  Exit



Regular Expression Search and Composition

 Command                Action


 ESC C-s Ret.            Search for a regular expression forward

 ^                                  Matches beginning of a line

 $                                  Matches the end of a line

 .                                   Matches any single character

 .*                                 Matches any group of 0+ characters

 \ <                                Matches the beginning of a word

 \ >                                Matches the end of a word

 [ ]                                 Matches chars within the brackets