Post

Emacs Keybindings: A Comprehensive Reference from Basics to Advanced

Emacs Keybindings: A Comprehensive Reference from Basics to Advanced

This is the keybinding reference I wish I had when I started using Emacs seriously. It covers the built-in defaults, the package bindings I actually use daily, and the muscle memory that makes Emacs feel fast once it clicks.

Notation: C- = Ctrl, M- = Alt/Option, S- = Shift, SPC = Space, RET = Enter, DEL = Backspace.


Core Bindings

KeyAction
C-fForward char
C-bBackward char
M-fForward word
M-bBackward word
C-nNext line
C-pPrevious line
C-aBeginning of line
C-eEnd of line
M-<Beginning of buffer
M->End of buffer
C-vScroll down (page)
M-vScroll up (page)
C-lRecenter screen
M-g gGo to line number
M-g cGo to char position

Structural Navigation

KeyAction
C-M-fForward sexp
C-M-bBackward sexp
C-M-aBeginning of defun
C-M-eEnd of defun
C-M-uUp sexp (out of parens)
C-M-dDown sexp (into parens)
C-M-nNext sexp (same level)
C-M-pPrevious sexp (same level)

C- moves by character, M- moves by word, C-M- moves by structure.

Editing

KeyAction
C-dDelete char forward
DELDelete char backward
M-dKill word forward
M-DELKill word backward
C-kKill to end of line
C-wKill region (cut)
M-wCopy region
C-yYank (paste)
M-yCycle yank ring (after C-y)
C-/Undo
C-x uUndo (alternate)
C-tTranspose chars
M-tTranspose words
C-x C-tTranspose lines
M-uUppercase word
M-lLowercase word
M-cCapitalize word
M-SPCCycle spacing
M-qFill paragraph
C-M-kKill sexp
C-oOpen line
C-jNewline and indent

Mark and Region

KeyAction
C-SPCSet mark (start selection)
C-x hSelect all
M-hMark paragraph
C-M-hMark function
C-M-SPCMark sexp
C-x C-xExchange point and mark

Search and Replace

KeyAction
C-sIsearch forward
C-rIsearch backward
C-M-sIsearch forward (regexp)
C-M-rIsearch backward (regexp)
M-%Query replace
C-M-%Query replace (regexp)
M-s oOccur (list matches)
M-s h rHighlight regexp
M-s h uUnhighlight regexp

Files and Buffers

KeyAction
C-x C-fFind file
C-x C-sSave file
C-x C-wSave as
C-x sSave all modified buffers
C-x bSwitch buffer
C-x C-bList buffers (ibuffer)
C-x kKill buffer
C-x C-rFind file read-only
C-x C-vFind alternate file

Windows

KeyAction
C-x 0Delete current window
C-x 1Delete other windows
C-x 2Split horizontally
C-x 3Split vertically
C-x oSwitch to other window
C-x ^Enlarge vertically
C-x }Enlarge horizontally
C-x {Shrink horizontally
S-<arrow>Windmove (directional)

Registers and Bookmarks

KeyAction
C-x r SPCSave point to register
C-x r jJump to register
C-x r sCopy region to register
C-x r iInsert register contents
C-x r wSave window config
C-x r fSave frame config
C-x r mSet bookmark
C-x r bJump to bookmark
C-x r lList bookmarks

Help

KeyAction
C-h kDescribe key
C-h fDescribe function
C-h vDescribe variable
C-h mDescribe current modes
C-h bList all keybindings
C-h aApropos (search commands)
C-h iInfo manual
C-h tTutorial

Package Keybindings

Magit (Git)

KeyAction
C-x gOpen magit-status
s / uStage / unstage
c cCommit
C-c C-cConfirm commit message
C-c C-kCancel commit
P pPush
F pPull
b b / b cSwitch / create branch
l l / l aLog current / all
d dDiff
fFetch
rRebase popup
mMerge popup
tTag popup
zStash popup
g / qRefresh / quit
TABToggle section
$Show process output

FZF (Fuzzy Finder)

KeyAction
C-c f fFind git files
C-c f gFZF in git repo
C-c f dFZF in directory
C-c f sGit grep
C-c f pFZF in project

Ripgrep (rg)

KeyAction
M-x rgRipgrep search
M-x rg-projectSearch in project
M-x rg-dwimSearch thing at point
C-c sRipgrep menu

In results: n/p navigate, RET visits, e enters wgrep, g reruns, q quits.

Multiple Cursors

KeyAction
C->Mark next like this
C-<Mark previous like this
C-c C-<Mark all like this

Corfu (Completion)

KeyAction
(auto)Popup after 2 chars
TABSelect/expand
M-n / M-pNext / previous
RETAccept
C-gQuit

Vertico (Minibuffer)

KeyAction
C-n / C-pNext / previous
RETAccept
TABPartial insert
C-gQuit

Orderless matching — type words in any order.

Eglot (LSP)

KeyAction
M-.Go to definition
M-,Go back
M-?Find references
C-c C-rRename symbol
C-c C-aCode actions
M-x eglot-formatFormat buffer
C-h .Show docs (eldoc)

Smartparens

KeyAction
C-M-f / C-M-bForward / backward sexp
C-M-kKill sexp
C-M-SPCMark sexp
C-M-u / C-M-dUp / down sexp
C-M-n / C-M-pNext / previous sexp

Go Mode

KeyAction
C-c C-rRemove unused imports
C-c C-gGo to imports
C-c C-fRun gofmt

Org Mode

KeyAction
TABCycle visibility
S-TABCycle global visibility
M-RETNew heading
M-S-RETNew TODO heading
C-c C-tToggle TODO state
C-c C-sSchedule
C-c C-dDeadline
C-c C-cToggle checkbox / execute
C-c 'Edit source block
C-c C-eExport dispatcher
C-c C-lInsert/edit link
C-c C-oOpen link at point
C-c aAgenda
C-c cCapture
M-<up/down>Move subtree
M-<left/right>Promote / demote

Ediff (Diff/Merge)

KeyAction
n / pNext / previous diff
jJump to diff
aCopy A to B / choose A
bCopy B to A / choose B
r a / r bRestore region A / B
v / VScroll down / up
w a / w bSave buffer A / B
!Recompute diffs
qQuit

Dired (File Manager)

KeyAction
C-x dOpen dired
RETOpen file
^Parent directory
m / u / UMark / unmark / unmark all
tToggle marks
% mMark by regexp
d / xFlag / execute deletion
DDelete immediately
C / RCopy / rename
ZCompress/decompress
!Shell command on marked
C-x C-qwdired (edit filenames)
C-c C-cCommit wdired

Advanced Built-in Commands

Keyboard Macros

KeyAction
C-x (Start recording
C-x )Stop recording
C-x eExecute (then e to repeat)
C-u 0 C-x eExecute until error
C-u 50 C-x eExecute 50 times
C-x C-k nName last macro
C-x C-k bBind macro to key
C-x C-k eEdit last macro
C-x C-k rApply to each line in region
C-x C-k C-cSet counter
C-x C-k C-iInsert counter
C-x C-k C-aSet increment

Rectangle Operations

KeyAction
C-x SPCRectangle mark mode
C-x r kKill rectangle
C-x r yYank rectangle
C-x r dDelete rectangle
C-x r oOpen (insert space)
C-x r cClear (replace with spaces)
C-x r tReplace with string
C-x r NNumber lines

Narrowing

KeyAction
C-x n nNarrow to region
C-x n dNarrow to defun
C-x n pNarrow to page
C-x n wWiden (restore)

Shell and Process Interaction

KeyAction
M-!Shell command
M-&Async shell command
M-x shellInteractive shell
M-x eshellEmacs shell
M-x termTerminal emulator
M-x compileRun compile
M-x recompileRerun compile

Advanced Isearch

While isearch is active:

KeyAction
M-eEdit search string
C-wYank word at point
C-M-yYank char at point
M-s .Symbol at point
M-s wToggle word mode
M-s rToggle regexp mode
M-s cToggle case sensitivity
M-s oOccur with search
M-n / M-pSearch history

Numeric / Universal Arguments

KeyAction
C-uUniversal arg (4)
C-u C-u16
C-u 8 / M-8Numeric arg 8
C-u - / M--Negative arg

How C-u modifies commands:

KeyEffect
C-u 10 C-nMove down 10 lines
C-u C-kKill entire line
C-u C-SPCPop mark ring
C-u C-lRecenter at top

Dynamic Abbreviation

KeyAction
M-/Dabbrev expand
C-M-/Dabbrev completion
M-x hippie-expandMulti-method expand

Repeat

KeyAction
C-x zRepeat last command
zKeep repeating

Indirect Buffers

KeyAction
M-x clone-indirect-bufferClone buffer
C-x 4 cClone in other window

Align

KeyAction
M-x alignAuto-align region
M-x align-regexpAlign on regexp
M-x align-currentAlign current section

Sort and Reverse

KeyAction
M-x sort-linesSort alphabetically
M-x sort-fieldsSort by Nth field
M-x sort-numeric-fieldsSort numerically
M-x reverse-regionReverse lines
M-x delete-duplicate-linesRemove duplicates

Calc

KeyAction
C-x * cOpen calc
C-x * qQuick calc (minibuffer)
C-x * eEmbedded mode
C-x * gGrab region to stack
C-x * yYank result to buffer

Whitespace

KeyAction
M-\Delete surrounding whitespace
M-SPCCollapse to single space
C-x C-oDelete blank lines
M-^Join with previous line
M-x whitespace-modeVisualize whitespace
M-x untabifyTabs to spaces

Tramp (Remote Editing)

KeyAction
C-x C-f /ssh:host:/pathOpen remote file
C-x C-f /sudo::/etc/hostsOpen as root
C-x d /ssh:host:/dir/Remote dired

Hideshow (Code Folding)

KeyAction
C-c @ C-hHide block
C-c @ C-sShow block
C-c @ C-cToggle block
C-c @ C-M-hHide all
C-c @ C-M-sShow all

Imenu (Buffer Index)

KeyAction
M-x imenuJump to definition
M-g iImenu (alternate)

Recursive Editing

KeyAction
C-r (in query-replace)Enter recursive edit
C-M-cExit recursive edit
C-]Abort recursive edit

Macro Query

KeyAction
C-x q (recording)Insert query point
SPC / y (playback)Continue
DEL / n (playback)Skip iteration
RET / q (playback)Stop
C-r (playback)Recursive edit

Miscellaneous

KeyAction
C-x C-eEval last sexp
M-:Eval expression
C-x =Char info at point
C-x 8 RETInsert Unicode by name
M-x revert-bufferReload from disk
C-x C-+ / C-x C--Zoom in / out
M-x ffapFind file at point

Patterns Worth Internalizing

  • C-x prefix = global operations (files, buffers, windows, registers)
  • C-c prefix = mode-specific and user bindings
  • C-h prefix = help
  • M-x = run any command by name (the escape hatch for everything)
  • C- moves by character, M- moves by word, C-M- moves by structure
  • Kill (C-k, C-w, M-d) saves to the kill ring. Delete (C-d, DEL) doesn’t.
  • Prefix any command with C-u for a numeric argument: C-u 10 C-n moves down 10 lines
  • C-g cancels anything — the universal “get me out of here”

The real productivity comes not from memorizing every binding, but from knowing the patterns well enough to guess what a binding might be — and using C-h to confirm.

This post is licensed under CC BY 4.0 by the author.