Emacs Cheatsheet

Key bindings, buffers, windows, search, editing & packages

Editor
Contents
📝

Basics

# Notation: C- = Ctrl, M- = Meta(Alt/Esc)

C-x C-c     # quit Emacs
C-g         # cancel current command
C-x C-s     # save file
C-x C-f     # open file
C-x C-w     # save as

# Undo / Redo
C-/         # undo
C-g C-/     # redo

# Command
M-x         # execute command by name
M-x shell   # open shell
📁

Files & Buffers

C-x C-f     # find (open) file
C-x C-s     # save
C-x C-w     # save as
C-x k       # kill buffer
C-x b       # switch buffer
C-x C-b     # list buffers
C-x i       # insert file contents

# Recent files
M-x recentf-open-files
✏️

Editing

C-d         # delete char forward
M-d         # delete word forward
C-k         # kill to end of line
M-k         # kill to end of sentence
C-w         # kill (cut) region
M-w         # copy region
C-y         # yank (paste)
M-y         # cycle through kill ring

C-SPC       # set mark (start selection)
C-x h       # select all

C-t         # transpose chars
M-u         # uppercase word
M-l         # lowercase word
M-c         # capitalize word
C-x C-u     # uppercase region
C-x C-l     # lowercase region
Tab         # indent
🪟

Windows & Frames

C-x 2       # split horizontal
C-x 3       # split vertical
C-x o       # switch window
C-x 0       # close current window
C-x 1       # close all other windows
C-x ^       # enlarge window
C-x {       # shrink horizontally
C-x }       # enlarge horizontally

Help & Packages

C-h t       # tutorial
C-h k       # describe key
C-h f       # describe function
C-h v       # describe variable
C-h a       # search commands
C-h m       # describe mode

# Package management
M-x package-install
M-x package-list-packages

# Popular packages
# magit, org-mode, company, helm, ivy
# projectile, flycheck, lsp-mode