Emacs

Enjoy this cheat sheet at its fullest within Dash, the macOS documentation browser.

Motion

C-a

Move to the beginning of line

beginning-of-line

C-e

Move to the end of line

end-of-line

C-f

Move forward a character

forward-char

C-b

Move back a character

backward-char

M-f

Move forward a word

forward-word

M-b

Move backward a word

backward-word

Editing

C-d

Delete one character at point

delete-char

Rubout

Delete one character backward

backward-delete-char

C-q

C-v

Quoted insert

quoted-insert

M-TAB

M-C-i

Insert a tab character

tab-insert

C-t

Exchange the char before cursor with the character at cursor

transpose-chars

M-t

Exchange the word before cursor with the word at cursor

transpose-words

M-u

Uppercase the current word

upcase-word

M-l

Lowercase the current word

downcase-word

M-c

Capitalize the current word

capitalize-word

Killing and Yanking

C-k

Kill the text from point to the end of the line

kill-line

C-x Rubout

Kill backward to the beginning of the line

backward-kill-line

C-u

Kill backward from point to the beginning of the line

unix-line-discard

M-d

Kill from point to the end of the current word

kill-word

M-Rubout

Kill the word behind point

backward-kill-word

C-w

Kill the word behind point, using white space as a word boundary

unix-word-rubout

M-\

Delete all spaces and tabs around point

delete-horizontal-space

C-y

Yank the top of the kill ring into the buffer at point

yank

M-y

Rotate the kill ring, and yank the new top

yank-pop

Keyboard Macros

C-x (

Begin saving the chars typed into the current keyboard macro

start-kbd-macro

C-x )

End saving the chars typed into the current keyboard macro

end-kbd-macro

C-x e

Re-execute the last keyboard macro defined

call-last-kbd-macro

Completing

TAB

Attempt to perform completion on the text before point

complete

M-?

List the possible completions of the text before point

possible-completions

M-*

Insert all completions of the text before point generated by possible-completions

insert-completions

Manipulating the History

Return

Accept the line regardless of where the cursor is

accept-line

C-p

Fetch the previous command from the history list

previous-history

C-n

Fetch the next command from the history list

next-history

M-<

Move to the first line in the history

beginning-of-history

M->

Move to the end of the input history

end-of-history

C-r

Search backward starting at the current line (incremental)

reverse-search-history

C-s

Search forward starting at the current line (incremental)

forward-search-history

M-p

Search backward using non-incremental search

non-incremental-reverse-search-history

M-n

Search forward using non-incremental search

non-incremental-forward-search-history

M-C-y

Insert the n-th argument to the previous command at point

yank-nth-arg

M-

M-_

Insert the last argument to the previous command

yank-last-arg

Rectangles

C-x r k

Kill the text of the region-rectangle, saving its contents as the "last killed rectangle"

kill-rectangle

C-x r M-w

Save the text of the region-rectangle as the "last killed rectangle"

copy-rectangle-as-kill

C-x r d

Delete the text of the region-rectangle

delete-rectangle

C-x r y

Yank the last killed rectangle with its upper left corner at point

yank-rectangle

C-x r o

Insert blank space to fill the space of the region-rectangle. This pushes the previous contents of the region-rectangle to the right

open-rectangle

C-x r N

Insert line numbers along the left edge of the region-rectangle. This pushes the previous contents of the region-rectangle to the right

rectangle-number-lines

C-x r c

Clear the region-rectangle by replacing all of its contents with spaces

clear-rectangle

M-x

Delete whitespace in each of the lines on the specified rectangle, starting from the left edge column of the rectangle

delete-whitespace-rectangle

C-x r t

Replace rectangle contents with string on each line

string-rectangle

M-x

Insert string on each line of the rectangle

string-insert-rectangle

C-x <space>

Toggle Rectangle Mark mode. When this mode is active, the region-rectangle is highlighted and can be shrunk/grown, and the standard kill and yank commands operate on it

rectangle-mark-mode

Miscellaneous

C-x

C-r

Read and execute the contents of inputrc file

re-read-init-file

C-g

Abort the current editing command and ring the terminals bell

abort

M-a

M-b

If the metafield char x is lowercase run the command that is bound to uppercase char

do-uppercase-version

ESC

Metafy the next character typed. For example, ESC-p is equivalent to Meta-p

prefix-meta

C-_

C-x

C-u

Incremental undo, separately remembered for each line

undo

M-r

Undo all changes made to this line

revert-line

M-&

Perform tilde expansion on the current word

tilde-expand

C-@

M-<space>

Set the mark to the point

set-mark

C-x C-x

Swap the point with the mark

exchange-point-and-mark

C-]

Move to the next occurance of current character under cursor

character-search

M-C-]

Move to the previous occurrence of current character under cursor

character-search-backward

M-#

Without argument line is commented, with argument uncommented (if it was commented)

insert-comment

C-e

When in vi mode, switch to emacs mode

emacs-editing-mode

M-C-j

When in emacs mode, switch to vi mode

vi-editing-mode

M-0, M-1, ...

Specify the digit to the argument

digit-argument

Notes