Emacs Commands Cheat Sheet



Motion

C-a

beginning-of-line

C-e

end-of-line

C-f

forward-char

C-b

backward-char

M-f

forward-word

M-b

backward-word

Editing

Emacs has waaay too many commands to fit on a cheat sheet. Not only that but I often find that many of the commands I use are from third party add-ons (e.g. Icicles, org-mode). I believe that the key to learning Emacs is effective command discover. Emacs Cheat Sheet Notation C-x Hold down CONTROL and press x M-x Press and release ESC, then press x (On some machines, you can hold down ALT and press x) Starting, Quitting, and Help emacs file From the UNIX command line, open file in emacs. C-x C-c Quit emacs C-g Abort current command C-x u Undo last command C-h t Run tutorial.

Emacs cheat sheet gnu

C-d

delete-char

Rubout

backward-delete-char

C-q

C-v

quoted-insert

M-TAB

M-C-i

tab-insert

C-t

Exchange the char before cursor with the character at cursor

M-t

Exchange the word before cursor with the word at cursor

M-u

Uppercase the current word

M-l

Lowercase the current word

M-c

Capitalize the current word

Emacs Commands Cheat Sheet

Killing and Yanking

C-k

kill-line

C-x Rubout

backward-kill-line

C-u

Kill backward from point to the beginning of the line

M-d

Kill from point to the end of the current word

M-Rubout

Kill the word behind point

C-w

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

M-

Delete all spaces and tabs around point

C-y

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

M-y

Rotate the kill ring, and yank the new top

Emacs Commands Cheat Sheet 2020

Keyboard Macros

C-x (

Begin saving the chars typed into the current keyboard macro

C-x )

End saving the chars typed into the current keyboard macro

C-x e

Re-execute the last keyboard macro defined

Completing

TAB

Attempt to perform completion on the text before point

M-?

List the possible completions of the text before point

M-*

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

Manipulating the History

Return

accept-line

C-p

previous-history

C-n

next-history

M-<

beginning-of-history

M->

end-of-history

C-r

Search backward starting at the current line (incremental)

C-s

Search forward starting at the current line (incremental)

M-p

Search backward using non-incremental search

M-n

Search forward using non-incremental search

M-C-y

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

M-

M-_

Insert the last argument to the previous command

Emacs Cheat Sheet Pdf

Doom emacs cheat sheet

Rectangles

C-x r k

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

C-x r M-w

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

C-x r d

Delete the text of the region-rectangle

C-x r y

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

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

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

C-x r c

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

M-x

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

C-x r t

Replace rectangle contents with string on each line

M-x

Insert string on each line of the 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

Miscellaneous

Emacs Cheat Sheet Wallpaper

Cheat

C-x

C-r

re-read-init-file

C-g

Abort the current editing command and ring the terminals bell

M-a

M-b

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

ESC

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

C-_

C-x

C-u

Incremental undo, separately remembered for each line

M-r

Undo all changes made to this line

M-&

Perform tilde expansion on the current word

C-@

M-<space>

Set the mark to the point

C-x C-x

Swap the point with the mark

C-]

Move to the next occurance of current character under cursor

M-C-]

Move to the previous occurrence of current character under cursor

M-#

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

C-e

When in vi mode, switch to emacs mode

M-C-j

When in emacs mode, switch to vi mode

M-0, M-1, ...

Specify the digit to the argument

Notes

  • Based on the cheat sheet from cheat-sheets.org.
  • Converted by @erggo.