Emacs Cheat Sheet
Key Notation
C = Control
M = Meta (Alt/Option)
SPC = Leader key (Doom Emacs)
Examples:
C-a → Ctrl + a
C-x o → Ctrl + x, then o
Basics
| Keys | Description |
C-x C-c | Quit Emacs |
C-g | Cancel command |
C-x C-s | Save buffer |
C-x b | Switch buffer |
C-x k | Kill buffer |
C-x C-f | Open file |
C-/ or C-_ | Undo |
C-x u | Undo (alt) |
Movement
Buffer/File
| Keys | Description |
M-< | Beginning of buffer |
M-> | End of buffer |
C-v | Page down |
M-v | Page up |
C-l | Center screen |
Lines
| Keys | Description |
C-a | Beginning of line |
C-e | End of line |
C-n | Next line |
C-p | Previous line |
M-g g | Go to line |
Words, Characters & Sentences
| Keys | Description |
M-f | Forward word |
M-b | Backward word |
C-f | Forward char |
C-b | Backward char |
M-a | Previous sentence |
M-e | Next sentence |
Searching
| Keys | Description |
C-s | Incremental search forward |
C-r | Incremental search backward |
M-% | Search and replace |
Kill Ring (Copy/Cut/Paste)
| Keys | Description |
C-SPC | Set mark (select region) |
M-w | Copy region |
C-w | Cut region |
C-y | Yank (paste) |
M-y | Cycle through kill ring |
M-d | Kill word forward |
M-DEL | Kill word backward |
C-k | Kill line |
Editing & Formatting
| Keys | Description |
Tab | Indent line |
C-j | New line + indent |
M-| | Delete spaces/tabs around point |
C-d | Delete next char |
DEL | Delete previous char |
C-t | Swap characters |
M-u | Uppercase word |
M-l | Lowercase word |
C-u n char | Insert n copies of char |
Rectangle mode: C-x SPC → select, C-x r t → insert
Help
| Keys | Description |
C-h k | Describe keybinding |
C-h f | Describe function |
C-h m | Describe mode |
C-h v | Describe variable |
describe-char | Describe character |
describe-face | Describe face/theme |
Windows/Frames
| Keys | Description |
C-x o | Switch window |
C-x 1 | Close other windows |
C-x 2 | Split horizontally |
C-x 3 | Split vertically |
C-x 0 | Close current window |
Packages & Plugins
Cider (Clojure)
| Keys | Description |
C-c M-n M-n | Switch namespace |
C-x C-e | Eval expression |
C-c C-k | Compile buffer |
C-c C-d C-d | Show doc for symbol |
M-. / M-, | Jump to source / back |
C-c C-d C-a | Apropos search |
M-x cider-jack-in | Start REPL |
C-c C-x C-j C-j | Alt start REPL |
C-↑ / C-↓ | Cycle REPL history |
C-RET | Close parens + eval |
Paredit
| Keys | Description |
M-x paredit-mode | Toggle mode |
M-( | Wrap in parentheses |
C-→ | Slurp (expand parens) |
C-← | Barf (shrink parens) |
C-M-f / C-M-b | Move to paren |
Evil Mode (Vim-style)
| Keys | Description |
h j k l | Cursor navigation |
SPC w h/j/k/l | Move to window |
SPC w H/J/K/L | Move window |
C-x 3 | Split right |
SPC w v/V | Vertical split |
g ; / g , | Goto last change |
Doom Emacs
| Keys | Description |
C-g | Escape |
SPC j j | Jump to word |
SPC SPC / SPC p p | Switch project |
SPC p a | Add project |
SPC f f | Find file |
SPC b b | Buffer list |
SPC h t | Toggle theme |
SPC c x | Show diagnostics |
C-u C-x = | Cursor position |
Workflows
- Projects
M-x projectile-add-known-project → add project
projectile-display-buffer → list projects
treemacs-edit-workspaces → edit workspaces
C-x d → dired navigation
- Julia REPL
SPC w V → vertical split
SPC b B → find REPL buffer
- LaTeX
LaTeX-find-matching-begin/end → jump to matching
TeX-command-master → run TeX
reftex-label (C-c () → insert label
reftex-citation (C-c [) → insert citation
reftex-renumber-simple-labels → renumber equations
- Shell
- Packages
M-x list-packages → List packages
M-x package-refresh-contents → Refresh package list
References