Last updated 2/6/2008 by Darryl Yong
This file contains useful keyboard shortcuts for emacs. Please send corrections or suggestions to dyong@hmc.edu.
| C-h i | Get Help using Info |
| C-h a | Get Help using apropos (useful when you know what you want to do but don't know the command name) |
| C-g | Quit out of any command and puts the cursor back in the editing window |
| C-x C-c | Quit emacs |
| C-x C-s | Save the file you're working on |
| C-x C-w | Save the file you're working on under new name |
| C-_ | Undo |
| C-x C-f | Open a new file (opens a new buffer if needed) |
| C-x C-k | Kill the current buffer |
| C-x C-b | Switch to another buffer |
| M-x | Press this to issue a command to emacs (tab completion works) |
| C-v | Move one screenful down (also [PageUp]) |
| M-v | Move one screenful up (also [PageDown]) |
| C-a | Move to the beginning of the line |
| C-e | Move to the end of the line |
| M-< | Move to the beginning of the buffer |
| M-> | Move to the end of the buffer |
| C-[space] | Set the mark to the current location of the cursor (actually, this adds the location to the mark ring) |
| C-u C-[space] | Put the cursor back to the mark (actually, cycles through the positions in the mark ring if used repeatedly) |
| C-l | Center window around the current line (and refresh window) |
| C-x 2 | Split window vertically |
| C-x o | Switch to other window |
| C-x 1 | Delete other windows (go back to a single window) |
| C-d | Delete one character (also [Del] key on the keyboard) |
| C-k | Kill a line (this is like "cut"--actually puts the line(s) onto the kill ring) |
| C-y | Yank back the lines on the kill buffer (this is like "paste"--actually uses the first block of text on the kill ring) |
| M-y | Cycle through the kill ring (only works after issuing a yank) |
| C-w | Kill region (everything between the mark and the current location of the cursor) |
| C-s | Search (forward) |
| C-r | Search (reverse) |
| M-% | Search and replace (interactive, use ! to replace all) |
| C-c C-c | Compile LaTeX file (can view and issue other commands on the source file) |
| C-c C-; | Comment region (everything between the mark and the current location of the cursor) |
| C-c ` | If an error occurs while compiling, this puts the cursor where the error occured |
| M-C-f | Move cursor to matching parenthesis, bracket, or brace |
| C-x r k | Kill a rectangle of text (using the mark and current location of cursor as the corners of the rectangle) |
| C-x r y | Yank rectangle |
| C-x ( | Begin recording a sequence of keystrokes as a macro |
| C-x ) | Stop recording a macro (any ringing of the bell will cause the recording to abort) |
| C-x e | Execute the recorded macro |
| M-{number} C-x e | Execute the macro {number} times |
| M-x query-replace-regexp | Search and replace using regular expressions |
| C-u 0 M-x byte-recompile-directory | Recompile a whole directory of Lisp files (useful when installing AUCTeX, for example) |