Emacs command cheat sheet

advertisement
Emacs Command Cheat Sheet


“C-x” means “press and hold the control key and then press and release the ‘x’ key”
“M-x” means “press and then release the Meta key and then press the ‘x’ key.”
The “Meta key” on a PC is the one marked ESC (Escape); on a Mac, it’s the one that looks like
this:
; on a Unix machine, it’s the one with a solid diamond on it.
Emacs basic commands
Command
Open a file
Insert another file at the current cursor position
Save current file
Save current file with another name (similar to
“Save as”)
Open an additional file
Moving around an Emacs buffer
Command
Move to the beginning of a buffer
Move to the end of a buffer
Move forward one character
Move backward one character
Move down one line
Move up one line
Move forward one word
Move backward one word
Move to the end of a line
Move to the beginning of a line
Move forward one screen
Move backward one screen
Cutting (deleting) text
Command
Delete character
Delete previous character
Delete word
Delete previous word
Delete the entire line
Keystroke
C-x C-f
C-x i
C-x C-s
C-x C-w
C-x C-f
Keystroke
M-<
M->
C-f
C-b
C-n
C-p
M-f
M-b
C-e
C-a
C-v
M-v
Keystroke
C-d
DEL (or BACKSPACE on some keyboards)
M-d
M-DEL (or M-BACKSPACE on some
keyboards)
C-k
2
Marking text to delete, move, or copy
Command
Mark the beginning of a selection
Delete the marked region
Copy a marked region
Paste (Yank) a cut or copied region
Searching & replacing text
Command
Incremental search forward
Incremental search backward
Exit incremental search
Cancel incremental search (or just about any
other command)
Delete incorrect character in search string of
incremental search
Non-incremental search forward
Non-incremental search backward
Start query replace
Replace current instance and continue
on to next instance
Don’t replace current instance, but
move on to next instance
Replace the current instance and then
quit
Replace the current instance and then
pause
Resume after pausing
Replace remaining instances without
asking
Back up to previous instance
Exit query replace
Search for a group of sequential
characters forward
Search for a group of sequential
characters backward
Search for a group of sequential
characters forward and incrementally
Search for a group of sequential
characters backward and incrementally
Keystroke
C-@ or C-SPACEBAR
C-w
M-w or C-INSERT
C-y
Keystroke
C-s
C-r
<ENTER> or <RETURN>
C-g
DEL (or M-BACKSPACE on some keyboards)
C-s RETURN (or ENTER on some keyboards)
C-r RETURN (or ENTER on some keyboards)
M-%
SPACEBAR or y
DEL (or M-BACKSPACE on some keyboards)
or n
. (period key)
, (comma key)
SPACEBAR or y
!
^
RETURN (or ENTER on some keyboards) or
q
M C-s RETURN (ENTER on some keyboards)
FOLLOWED by thisIsMySearchExpressio*
M C-r RETURN (ENTER on some keyboards)
FOLLOWED by thisIsMySearchExpressio*
M C-s
M C-r
3
Moving among buffers
Command
Move to the previous buffer
Display buffer list
Delete current buffer
Create two windows
Move to the other window
Delete the current window
Delete all other windows except the current
one
Various other commands
Command
Undoing recent changes
Undo all changes since the last save
Go back to an earlier version of the current file
(the file as it appeared when you first opened
it)
Pop out to your Unix prompt
Cancel current command
Keystroke
C-x b
C-x C-b
C-x k
C-x 2
C-x o
C-x O
C-x 1
Keystroke
C-x u
M-x revert-buffer
C-x C-f filename~ RETURN (RETURN ON
SOME keyboards) FOLLOWED BY C-x C-w
filename
C-z
C-g
This document was adapted from a larger document that can be found at
http://cs.iupui.edu/~kweimer/EmacsCheatSheet.pdf. Unfortunately, I’ve been unable to figure
out who produced the original document.
Download