CS21: Using Emacs

In the descriptions below, C stands for the Ctrl key and M stands for the Esc key. When you see a key combination like C-g you should hold down the Ctrl key while pressing the g key. However, when you see a key combination like M-f you should first press the Esc key and then press the f key.

General and File Commands

C-x C-c     Save buffer to file and exit emacs
C-x C-s     Save buffer to file and remain in emacs
C-x C-f     Open a file in a new buffer
C-g         Cancel command
C-x u       Undo

Navigation Commands

C-f (C-b)   Forward (backward) one character
M-f (M-b)   Forward (backward) one word
C-n (C-p)   Next (previous) line
C-a (C-e)   Beginning (end) of line
C-v (M-v)   Page down (up)
M-< (M->)   Beginning (end) of buffer
C-l         Redraw the screen centered at current line

Search Commands

C-s (C-r)   Search forwards (backwards)
M-%         Search and replace
M-g g       Go to line number

Cut and Paste Commands

C-Space     Set mark for beginning of region to cut or paste
C-w         Cut from first mark to current cursor location
M-x         Copy from first mark to current cursor location
C-y         Yank back the cut or copied region to the current location
C-d         Delete character
M-d         Delete word
C-k         Kill line