Spacemacs is an Emacs distribution that combines the best features of Emacs and Vim. Below is a cheat sheet for Spacemacs, highlighting some commonly used keybindings and commands.
General Navigation
- Movement:
h
,j
,k
,l
: Move left, down, up, and right.SPC
: Leader key.,
: Major mode leader key.
- Buffers:
SPC b b
: Switch buffer.SPC b d
: Kill buffer.SPC b n
: Next buffer.SPC b p
: Previous buffer.
- Windows:
SPC w
: Window management prefix.SPC w s
: Split horizontally.SPC w v
: Split vertically.SPC w d
: Delete window.
- Search:
SPC /
: Search project.SPC s s
: Search in the current buffer.
Editing
- Basic Editing:
i
: Enter insert mode.ESC
: Exit insert mode.SPC x
: Execute command prefix.
- Copy-Paste:
SPC x
: Execute command prefix.p
: Paste after cursor.P
: Paste before cursor.y
: Copy (yank).d
: Cut (delete).
- Undo-Redo:
u
: Undo.Ctrl + r
: Redo.
- Selection:
v
: Start selection (visual mode).V
: Start line selection.C-SPC
: Set mark.SPC x
: Execute command prefix.
File Operations
- Open File:
SPC f f
: Open file.SPC p f
: Find file in project.
- Save File:
SPC f s
: Save file.
- Close File:
SPC w d
: Close window (also closes file).
Version Control
- Git:
SPC g s
: Git status.SPC g p
: Git pull.SPC g P
: Git push.
Programming
- Compile/Run:
, c c
: Compile., c r
: Run.
- Debugging:
, d b
: Start debugging.
- Comment/Uncomment:
SPC c c
: Comment/uncomment region.
Spacemacs Layers
- Toggle Layers:
SPC l t
: Toggle layer.
Help and Documentation
- Documentation:
SPC h SPC
: Open Spacemacs documentation.SPC h d k
: Describe keybinding.SPC h d f
: Describe function.
- Tutorials:
SPC h SPC
: Open Spacemacs tutorials.
Quitting
- Exit Spacemacs:
SPC q q
: Quit Spacemacs.
Note
,
is the major mode leader key by default.- Keybindings can vary based on your personal configuration and the active layer.
This cheat sheet provides a basic overview of common Spacemacs keybindings.