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)

Tab-Bar Mode (Workspaces)

Invisible workspaces — tab bar is hidden, but tabs are active. Switch by number.

KeyAction
C-x t 2New tab
C-x t 0Close current tab
C-x t 1Close all other tabs
C-x t oNext tab
C-x t OPrevious tab
C-x t rRename tab
C-x t mMove tab
M-1 through M-5Switch to tab by number

Each tab has its own window configuration. Use them like virtual desktops — one tab for code, one for shell, one for notes.

Winner Mode (Window Undo)

Undo/redo window configuration changes. Accidentally closed a split? Undo it.

KeyAction
C-c <left>Undo window config change
C-c <right>Redo window config change

Works across any window operation — splits, deletes, resizes. The entire window layout history is tracked.

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 aAmend commit
c eExtend (add staged to last commit)
C-c C-cConfirm commit message
C-c C-kCancel commit
P pPush
P uPush to upstream
F pPull
b b / b cSwitch / create branch
b dDelete branch
l l / l aLog current / all
d dDiff
d sDiff staged
fFetch
rRebase popup
r iInteractive rebase
mMerge popup
ACherry-pick popup
tTag popup
zStash popup
z zStash (including untracked)
z pPop stash
BBisect popup
kDiscard change at point
vReverse change at point
xReset popup
g / qRefresh / quit
TABToggle section
$Show process output
M-x magit-blameBlame current file

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
M-x eglot-format-bufferFormat entire buffer
C-h .Show docs (eldoc)
M-x eglot-code-action-organize-importsOrganize imports
M-x eglot-find-implementationFind implementations
M-x eglot-find-typeDefinitionFind type definition
M-x eglot-inlay-hints-modeToggle inlay hints

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
C-c C-wRefile heading
C-c C-x C-aArchive subtree
C-c /Sparse tree (filter by regexp/TODO/etc.)
C-c .Insert timestamp
C-c C-x pSet property
M-<up/down>Move subtree
M-<left/right>Promote / demote
C-c C-x C-iClock in
C-c C-x C-oClock out

Org Capture

C-c c opens the capture dispatcher. Templates define what gets captured and where it goes.

KeyAction
C-c cOpen capture templates
C-c C-cFinalize capture (save and close)
C-c C-wRefile capture to different location
C-c C-kAbort capture (discard)
C-0 C-c cCapture to last-used template (skip menu)
C-u C-c cVisit last captured item
C-c C-dInsert deadline (in capture buffer)
C-c C-sInsert schedule (in capture buffer)
C-c C-tSet TODO state (in capture buffer)
C-c C-qSet tags (in capture buffer)

During capture, the buffer is a normal org buffer — all org bindings work. Add timestamps, tags, properties, links before finalizing with C-c C-c.

Org Tables

KeyAction
TABNext cell (auto-aligns table)
S-TABPrevious cell
RETNext row
M-<left/right>Move column left/right
M-<up/down>Move row up/down
M-S-<right>Insert column
M-S-<down>Insert row
M-S-<left>Delete column
M-S-<up>Delete row
C-c -Insert horizontal separator
C-c RETInsert separator and move below
C-c ^Sort table by column
C-c +Sum column of numbers
C-c *Recalculate table formulas

Org Babel (Source Blocks)

KeyAction
C-c C-cExecute source block at point
C-c 'Edit source block in native mode
C-c C-v tTangle (export code blocks to file)
C-c C-v bExecute all blocks in buffer
C-c C-v nNext source block
C-c C-v pPrevious source block
C-c C-v dDemarcate (wrap region in block)

In the agenda (C-c a):

KeyAction
aAgenda view (week)
tTODO list
sSearch
mMatch tags
n / pNext / previous item
RETGo to entry
tToggle TODO state
I / OClock in / out
rRefresh
qQuit agenda

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
oOpen file in other window
^Parent directory
+Create directory
m / u / UMark / unmark / unmark all
tToggle marks
% mMark by regexp
* .Mark by extension
d / xFlag / execute deletion
DDelete immediately
C / RCopy / rename
SSymlink
ZCompress/decompress
MChmod
GChgrp
sToggle sort (name/date)
(Toggle details (permissions, size)
iInsert subdirectory inline
!Shell command on marked
&Async shell command on marked
wCopy filename to kill ring
C-x C-qwdired (edit filenames)
C-c C-cCommit wdired
C-c C-kAbort wdired

Proced (Process Manager)

Built-in process manager. Open with M-x proced.

KeyAction
M-x procedOpen process list
gRefresh process list
mMark process
uUnmark process
MMark all
UUnmark all
dMark for deletion (SIGTERM)
xExecute marks (send signals)
kSend signal to process at point
sSort by column (toggle)
fFilter processes
tToggle tree view
RETRefine (show children of process)
n / pNext / previous process
qQuit proced

Like top/htop but inside Emacs. Mark multiple processes and send signals in bulk.

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
M-x grepGrep (results buffer)
M-x project-shellShell in project root
C-u M-!Insert command output at point
C-x backtickNext compilation error

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

EWW (Emacs Web Wowser)

Built-in web browser. Open with M-x eww.

KeyAction
GPrompt for new URL
gReload current page
lGo back in history
rGo forward in history
TABNext link
S-TABPrevious link
RETFollow link at point
vView page source
SPCScroll down
DEL / S-SPCScroll up
n / pScroll by line
bAdd bookmark
BList bookmarks
HList browsing history
wCopy current URL to kill ring
dDownload URL
RToggle readable mode (strips clutter)
FToggle fonts (use document fonts or not)
M-CToggle colors
DToggle display of images
qQuit eww buffer
SList all open eww buffers
+ / -Increase / decrease text size
C-c C-cSubmit form at point
&Open current URL in external browser
C-u M-x ewwOpen URL in new eww buffer

R (readable mode) is the killer feature — it strips navigation, ads, and sidebars, leaving just the article content. Works surprisingly well on most sites.

Elfeed (RSS Reader)

Open with M-x elfeed. Update feeds with M-x elfeed-update.

In the search buffer (feed list):

KeyAction
g / GRefresh feed / refresh all feeds
RETOpen entry
bOpen entry in browser
sUpdate search filter
SSet new search filter
rMark as read
uMark as unread
+Add tag
-Remove tag
n / pNext / previous entry
yYank (copy) entry URL
*Star/unstar entry (toggle starred tag)
qQuit elfeed

In the entry buffer (reading an article):

KeyAction
n / pNext / previous entry
bOpen in browser
gRefresh entry
SPC / S-SPCScroll down / up
+ / -Add / remove tag
uToggle unread
yYank entry URL
qBack to search buffer

Filter syntax examples:

  • @6-months-ago +unread — unread entries from last 6 months
  • +unread +blog — unread entries tagged “blog”
  • @1-week-ago +unread -junk — last week, unread, exclude “junk” tag
  • #10 +unread — first 10 unread entries
  • =Title regex — entries matching title regex

Tags are prefixed with + (include) or - (exclude). Time filters use @. Count limits use #. Title search uses =.

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.