Emacs Cheat Sheet

Starting emacs

> emacs [Enter]
to start emacs.
> emacs filename [Enter]
to start emacs and load a file
> emacs -nw filename [Enter]
to start emacs with no new window (load file)


[Ctrl]X [Ctrl]C
quit emacs (Can be used with impunity -- the system will prompt if the workspace has not yet been saved.)
aborts any command in progress


[Ctrl]H T
to see the tutorial
[Ctrl]H A topic [Enter]
to see help about topic
[Ctrl]X U
undo the last command

Cursor Positioning

[Ctrl]F or [>-]
forward (right) one character.
[Ctrl]B or [>-]
back (left) one character
[Ctrl]P or [^]
up one character
[Ctrl]N or [v]
down one character
left one word
right one word
to beginning of line
to end of line
start of document
end of document
page up
page down
cursor in middle of screen
[Ctrl]U 20 [Ctrl]N
advance 20 lines
[Ctrl]x w
display the line number where the cursor is located
[Esc]X goto-line [Enter] 999 [Enter]
go to line number 999

Search and Replace

[Ctrl]S patterntext [Enter]
search for patterntext; cursor moves as you type. Press [Enter] once at the correct location
[Ctrl]R patterntext [Enter]
search backwards for patterntext; cursor moves as you type.
[Ctrl]S [Enter] [Enter]
search for the next occurrence
[Esc]% oldstring [Enter] newstring [Enter]
Search for oldstring and replace it with newstring. The Y key confirms each replacement, N skips it, Q to exit


set mark at cursor
kill region
copy region to kill ring
yank back last thing killed

Loading and Saving

[Ctrl]X [Ctrl]F filename
create new filename for editing (clears workspace)
[Ctrl]X [Ctrl]F filename
load in filename for editing
[Ctrl]X [Ctrl]W filename
write (save) as filename
[Ctrl]X [Ctrl]S
resave under the current filename (based on above or name given when starting emacs)

Common Lisp

[Ctrl]X L
start Common Lisp lisp image

©1997 Fernando Lopez-Lezcano. All Rights Reserved.