Emacs

Presented by Erik Gillespie <rattles@yakko.cs.wmich.edu>

Sponsored by the Computer Club of Western Michigan University

Last Modified on September 16, 2003


Basic Text Editing

Navigation

Usually you can simply use the arrow keys.

C-nNext line
C-pPrevious line
C-fNext character
C-bPrevious character
C-vPage down
M-vPage up
M-fNext word
M-bPrevious word
C-eEnd of line
C-aBeginning of line

Editing Text

In X you can access these from the Edit menu.

C-spaceBegin selection
C-gCancel selection*
C-_Undo
C-wCut
M-wCopy
C-yPaste
C-x hSelect all
C-dDelete character
M-dDelete to end of word
C-kDelete to end of line

* C-g is also used as for canceling commands.

Working With Files

These options are available in the File menu.

C-x C-fOpen file
C-x C-sSave file
C-x C-wSave As
C-x kClose file
C-x bChange to different buffer/file
C-x C-cExit emacs

Note: Opening a file does not close a file that is already open!


Advanced Features

Advanced Editing

C-sSearch
M-%Search & Replace
C-M-sRegular Expression Search
C-M-%Regular Expression Search & Replace
M-cCapitalize word
M-uUppercase word
M-lLowercase word
M-(#) cmdRepeat next command (#) times.
C-u M-|Run shell command against selected text

Macros

C-x (Start recording macro
C-x )Start recording macro
C-x eExecute last recorded macro

Macros are very powerful when used with the M-(#) command.

Other Stuff

Help

C-h tEmacs Tutorial
C-h kDescribes key
C-h fDescribes function
C-h vDescribes variable
C-h bShow all key bindings
C-h iEmacs help browser
C-h aApropos help search

Getting Out of a Bind

C-x C-cExit Emacs
Esc : q ! RetExit Vi
C-gCancel current command
Esc Esc EscClose all other windows
(Can sometimes abort a command)
C-h ?Help options