Spacemacs quick reference

Reference commands for the spacemacs text editor.


Note that this will remove an existing Emacs configuration.

rm -rf ~/.emacs.d
git clone ~/.emacs.d

Then set up your configuration using a .spacemacs file.

Modifier keys

These are used frequently in Emacs documentation.

Emacs Meaning Keystroke
C Control Ctrl
M Meta Esc / Alt

Here are some examples showing how these modifiers are used in documentation, and how they map to keystrokes:

Other common keys

Emacs Meaning Keystroke
ALT Alt Alt
BS Backspace Backspace, C-h
CTRL Control Ctrl
DEL Delete Delete
LFD Line feed C-j
RET Return Return, Enter, C-m
SPC Spacebar Space
TAB Tab Tab

This guide on how keystrokes are denoted in Emacs is a useful reference.


This is often annoying for new users.

Keystroke Style
`SPC q q` Spacemacs
`C-x C-c` Emacs
`:q` Vim

Reloading configuration

Here’s how to reload the .spacemacs configuration file.

Keystroke Style
`SPC f e R` Spacemacs
`M-m f e R` Emacs

General commands

Find and replace


Emacs speaks statistics (ESS) is an incredibly useful interface for R programming on a remote server where RStudio is not available.

The Emacs documentation frequently refers to REPL, which stands for read-eval-print loop. You’ll see this in the ESS documentation for spacemacs.

The standard Ctrl+Enter console command will work when ESS major-mode keybindings are defined. Note that this might note be configured properly for spacemacs on a fresh install.

Key bindings

Send code to an inferior REPL process with these commands:

Key binding Description
SPC m c c send knitr/sweave chunk and keep buffer focused
SPC m c C send knitr/sweave chunk and switch to REPL in insert mode
SPC m c d send knitr/sweave chunk and step to next chunk
SPC m c m mark knitr/sweave chunk around point
SPC m c n next knitr/sweave chunk
SPC m c N previous knitr/sweave chunk
SPC m s b send buffer and keep code buffer focused
SPC m s B send buffer and switch to REPL in insert mode
SPC m s d send region or line and step (debug)
SPC m s D send function or paragraph and step (debug)
SPC m s i start an inferior REPL process
SPC m s l send line and keep code buffer focused
SPC m s L send line and switch to REPL in insert mode
SPC m s r send region and keep code buffer focused
SPC m s R send region and switch to REPL in insert mode
SPC m s t send thing at point (function) and keep code buffer focused
SPC m s T send thing at point (function) and switch to REPL in insert mode
C-j next item in REPL history
C-k previous item in REPL history


Helpers for inspecting objects at point are available in R buffers only.

Key binding Description
SPC m h d View data under point using ess-R-data-view
SPC m h t View table using ess-R-data-view

Refer to the ESS layer documentation for more information.

Useful Vim key bindings



Visual mode


Spacemacs uses magit by default to manage Git repositories.

Spacemacs uses evil-magit for key bindings in magit buffers (unless your editing style is set to emacs, in which case you get the default magit bindings), which are the standard magit key bindings with some minimal changes to make them comfortable for evil users.

Highlight by age of commit or last update time is provided by smeargle. Git time machine is provided by git-timemachine. Git last commit message per line is provided by git-messenger.

Common commands

Bindings inside status buffer

Staging lines

Magit allows you to stage specific lines by selecting them in a diff and hitting s to stage. Due to inconsistencies between Vim and Emacs editing styles, if you enter visual line state with V, you will stage one more line than intended. To work around this, you can use v instead (since Magit only stages whole lines, in any case).

Commit message editing buffer

Interactive rebase buffer

Quick guide for recurring use cases in Magit

Amend a commit

  1. l l: Open the log buffer.
  2. c a: Amend the commit.
  3. ~,c~; C-c C-c: Submit the changes.

Squash last commit

  1. l l: Open the log buffer.
  2. r e on the second to last commit; it opens the rebase buffer.
  3. j: Put point on last commit.
  4. s: Squash it.
  5. ~,c~; C-c C-c: Continue to the commit message buffer.
  6. ~,c~; C-c C-c (again): Edit the commit message.

Add upstream remote (the parent repository you have forked)

  1. M: Open the remote popup.
  2. a: Add a remote, type the name (i.e. upstream) and the URL.

Pull changes from upstream (the parent repository you have forked) and push

  1. F -r C-u F: Choose upstream or the name you gave to it.
  2. P P: Push the commit to origin.

Time machine

git-timemachine allows to quickly browse the commits of the current buffer.

Pairs of handy bracket mappings with unimpaired

Note that spacemacs contains an internal port of unimpaired.

Multiple cursors with evil-mc

Manage workspaces with eyebrowse