0% found this document useful (0 votes)
81 views2 pages

Emacs Cheat Sheets

This document provides a cheat sheet for basic Emacs commands. It summarizes commands for undo, finding and saving files, exiting Emacs, cursor motion, cutting/copying/pasting text, scrolling, opening files and buffers, searching/replacing text, and getting help. Additional resources for learning Emacs are also listed at the bottom.

Uploaded by

kvhrs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views2 pages

Emacs Cheat Sheets

This document provides a cheat sheet for basic Emacs commands. It summarizes commands for undo, finding and saving files, exiting Emacs, cursor motion, cutting/copying/pasting text, scrolling, opening files and buffers, searching/replacing text, and getting help. Additional resources for learning Emacs are also listed at the bottom.

Uploaded by

kvhrs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Emacs Cheat Sheet

(original version by David Cohen)


(revised by Bob Rogers)

Home : Emacs tips : Cheat sheet

UNDO: C-_ ("control underscore")


Find (or Create) file: C-x C-f
Save file: C-x C-s
Exit Emacs: C-x C-c
Quit (i.e. interrupt) command: C-g

Cursor Operation Cutting and Pasting


Motion Move Delete C- Mark one end of region
Amount forward backward forward backward SPC
C-w Cut (after you Mark and move to
Characters C-f C-b C-d DEL
other end)
Words M-f M-b M-d M-DEL
M-w Copy (after you Mark and move to
C-k (to C-SPC C-a other end)
Lines C-n C-p
EOL) C-w C-y Yank (paste) most recently killed
Sentences M-e M-a M-k C-x DEL (cut or copied); will also use text
Expressions C-M-f C-M-b C-M-k C-M-DEL currently selected in another
application.
(no standard
M-y Next most recently killed (do C-y
Paragraphs M-} M-{ bindings for delete
cmds) first, repeat M-y to cycle thru all)
To make cut/copy/paste behave as it
End/start of (repeat count goes does in other apps, do M-x cua-mode,
C-e C-a
line to following lines) or put
End/start of M-> M-< (no repeat count) (cua-mode)
buffer
in your .emacs to enable in every
session.

Scrolling and Windows Files and Buffers


C-v Scroll down (toward end of buffer) C-x C-f Find file (or create if not
M-v Scroll up (toward beginning of buffer) there); prompts for file name
C-M-v Scroll other window down C-x C-s Save file

C-x 1 One window on current buffer C-x C-w Write file; prompts for new
C-x 2 Split window vertically name
C-x s Save modified buffers; asks
C-x 3 Split window horizontally
about each
C-x ^ Grow window vertically; prefix is number of
C-x b Select buffer; prompts for
lines
buffer name
Command-related Stuff C-x C-b List buffers; shows in other
ESC Get me out of where I am now window
ESC
ESC C-x k Kill buffer; prompts for buffer
C-u # Prefix numeric arg # (digits with optional "-" name
sign) to next cmd Searching/Replacing
C-g Stop a command in progress, or quit out of a C-s Incremental search forward;
partially entered command searches as you type
Getting help C-r Incremental search
C-h k Show command documentation; prompts for backward
keystrokes C-M-s Regexp search forward
C-h a "Command apropos"; prompts for regexp and (there are differences in
shows all matching commands Emacs regexp syntax wrt
Perl, etc.)
C-h c Show command name on message line;
prompts for keystrokes
C-M-r Regexp search backward
C-h f Describe function; prompts for command or
M-x String replace from here to
replace- end of buffer; prompts for
function name, shows documentation in other string
window RET
string and replacement
C-h i Info browser; gives access to online M-x String replace from here to
documentation for emacs and more query- end of buffer, querying for
replace
each occurrence
Miscellaneous RET
M-x grep Prompts for a grep
C-_ or C-Undo/redo (a series of these keeps RET command, shows hits in a
x u undoing; after doing something else, C-_ buffer
or C-x u will undo the undo's)
C-x ` Visit next grep hit
C-q Quoted insert; inserts the next character
typed, even if it is a control or meta
character
M-x shell- Flush ^M at end of line
strip-
ctrl-m RET
C-z Suspend/iconify emacs (type "%emacs" in
invoking shell to get it back)
C-x C-c Exit emacs (asks about unsaved buffers
and running programs)

Other resources for learning emacs


Dave Cohen's original emacs cheat sheet at
http://www.primenet.com/~cohen/emacs_cheat.html (dead link), written by an alumnus of
the August bootcamp.
Tutorial outline for the tutorial presented at bootcamp on 4-Oct-99.
http://www.pdc.kth.se/training/Tutor/Basics/emacs/emacsis.great (dead link) tutorial
page (not hypertext), with a topical command summary at the bottom. This is very dense,
and covers a lot of ground.
GNU emacs FAQ. This is also available in emacs itself by typing "C-h F" (note that the "F"
must be capitalized). The Web version is hypertext, though it isn't very easy to navigate,
and it does have a reference page that points to all kinds of good stuff. The version within
emacs is not hypertext, but it's all on one page, and you can use C-s (incremental search)
to find things of interest.

Bob Rogers <[email protected]>

You might also like