The GNU Emacs Editor

For more information, see the GNU Emacs Manual by Richard M. Stallman (about $25 at local bookstores) or see:

Basic
Emacs
Commands

  • "Ctrl-x" means to
    hold down the
    control key
    and press x.

  • "ESC" means to
    press the escape
    (or "meta") key.

  • "RET" means to
    press the
    return key.
Category Command Keystrokes
HELP! Exit emacs Ctrl-x Ctrl-c
Get out of the miniwindow Ctrl-g
Undo last action Ctrl-x u
Redraw screen Ctrl-l
Run a tutorial Ctrl-h t
Psychotherapy ESC x doctor RET
Movement Page down or up Ctrl-v or ESC v
Move to front or end of line Ctrl-a or Ctrl-e
Move to front or end of function ESC { or ESC }
Move to front or end of buffer ESC < or ESC >
Inserting Insert characters Just type them!
Insert new line RET key
Open new line Ctrl-o
Insert a copy of last deleted line Ctrl-y
Deleting If BACKSPACE won't work Use DEL key
Delete line Ctrl-k
Searching
and
Replacing
Search forward Ctrl-s RET or
ESC x search-forward
Reverse search Ctrl-r RET
Repeat search Ctrl-s ESC p
Interactive replace ESC %
Global replace ESC x replace-string
Files Make new buffer and read file Ctrl-x Ctrl-f
Close current file and read a new one Ctrl-x Ctrl-v
Insert contents of a file here Ctrl-x i
Save current buffer Ctrl-x Ctrl-s
Write current buffer to new file Crtl-x Ctrl-w
Save all files from all buffers Ctrl-x s

Further
Emacs
Commands

  • "Ctrl-x" means to
    hold down the
    control key
    and press x.

  • "ESC" means to
    press the escape
    (or "meta") key.

  • "RET" means to
    press the
    return key.
Category Command Keystrokes
Windows Eliminate current window Ctrl-x 0 (zero)
Make the entire screen 1 window Ctrl-x 1
Split window in 2 vertically Ctrl-x 2
Split window in 2 horizontally Ctrl-x 3
Move cursor to other window Ctrl-x o
Buffers Move another buffer to this window Ctrl-x b
List all active buffers Ctrl-x Ctrl-b
Close the buffer in this window Ctrl-x k
Files Make new buffer and read file Ctrl-x Ctrl-f
Close current file and read a new one Ctrl-x Ctrl-v
Insert contents of a file here Ctrl-x i
Save current buffer Ctrl-x Ctrl-s
Write current buffer to new file Crtl-x Ctrl-w
Save all files from all buffers Ctrl-x s
C++ Commands Compile Esc x compile
then g++ -Wall -gstabs ...
Indent current line TAB
Indent whole file (using my .emacs file ) Ctrl-p
Find location of compile error CTRL-x `
(backward quote)
Start gdb debugger ESC x gdb
Unix Suspend emacs temporarily Ctrl-z (fg to resume)
Execute one Unix command ESC !


Michael Main (main@colorado.edu)