This page assumes you are using my emacs config at http://github.com/leeorengel/.emacs.d
This page has been organized roughly in order of importance in terms of the minimum keybindings you need to know to get going in emacs. Subsequent sections include more advanced groupings of keybindings.
Table of Contents
- Basic
- Navigation
- Selection/Copy/Paste
- Editing
- Evil
- Searching/Replacing
- File Management
- Directory Management
- Window Management
- Frame Management
- Projectile
- File Navigation (NeoTree)
- Multiple Cursors
- Coding
- Coding Navigation
- Commenting
- Smartparens
- Clojure
- CIDER
- Version Control (Magit)
- Org Mode
- Eshell
- Minibuffer
- Markdown
- Workgroups
- Help
- Miscellaneous
- Credits
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-x C-x | M-q | Quit |
C-x C-s | M-s | Save |
SPC f e R | Reload config | |
SPC f e d | Open .spacemacs |
Keybindings for very basic cursor movement.
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-p | k | move cursor to previous line | |
C-b | h | move cursor backward one character | |
C-f | l | move cursor forward one character | |
C-n | j | move cursor to next line | |
C-S-p | 5k | move cursor up 5 lines (e.g. faster) | Custom keybinding courtesy of magnars |
C-S-n | C-e | move cursor down 5 lines (e.g. faster) | Custom keybinding courtesy of magnars |
M-b | b | move cursor to previous word | |
M-f | w | move cursor to next word | |
C-M-b | ( | move cursor to previous s-expression | |
C-M-f | ) | move cursor to next s-expression | |
C-a | 0 | Go to beginning of line | |
C-e | $ | Go to end of line | |
f<char> | Go to next occurrence of char on line | ||
F<char> | Go to previous occurrence of char on line | ||
t<char> | Go to next occurrence before char on line | ||
T<char> | Go to previous occurrence before char on line |
Keybindings for jumping around inside a single buffer.
Keybinding | Spacemace Keybinding | Description | Notes |
---|---|---|---|
s-[ | s-[ | Previous cursor position within buffer | Custom keybinding |
s-] | s-] | Next cursor position within buffer | Custom keybinding |
M-< | gg | Go to beginning of buffer | |
M-> | G | Go to end of buffer | |
M-g g | :X | Go to line number X | |
C-l | M | Center screen at cursor/point | |
M-v | C-u | Scroll to previous screen | |
C-v | C-d | Scroll to next screen |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
jj | SPC SPC | Jump to char |
jk | Jump to consecutive chars | |
jl | SPC y | Jump to the beginning of a line (avy-goto-word-1 ) |
xx | SPC : | Executed extended command(execute-extended-command ) |
Keybindings for moving in between open buffers.
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-x | SPC b p | Previous buffer/file |
C-x | SPC b n | Next buffer/file |
Commands for selecting, cutting, copying and pasting regions of text.
Keybinding | Spacemacs keybinding | Description |
---|---|---|
C-SPACE | SPC v | Mark the beginning of a selection |
C-x C-x | o | Toggle between beginning and ending of selection |
M-w | y | Copy selection |
C-w | d | Cut and copy selection |
C-y | p | Paste (yank from kill ring) |
C-x h | Select entire buffer region |
Keybinding | Spacemacs keybinding | Description |
---|---|---|
C-= | SPC v | Initiate expand region |
C-= | v | Expend region by semantic unit |
C-- | V | Contract region by semantic unit |
r | Reset the region to initial selection | |
C-g | ESC | Leave expand-region mode |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-M-@ | Select s-expression | ||
C-M-h | Select function |
Keybindings for making changes within a buffer.
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-/ | u | Undo | |
C-S-/ | C-r | Redo | |
C-x u | SPC a u | Undo tree visualize | |
C-Shift-Del | dd | Delete current line | |
C-k | d$ | Delete rest of line from cursor | |
M-0 C-k | d0 | Delete from cursor to beginning of line | |
M-Del | db | Delete previous word | |
M-d | de | Delete next word | |
daw | Delete current word | ||
C-c d | yyp | Duplicate current line | |
C-x C-t | SPC x t l | Swap line with line above | |
M-z | df | delete up to char | Keep hitting char to go to next occurrence. C-K to delete. |
M-\ | delete all surrounding whitespace and tabs around cursor |
Keybinding | Description |
---|---|
r | Replace a single character |
cc | Change/replace entire line |
cf<char> | Change/replace to first occurrence of char from current position on current line |
ct<char> | Change/replace up to first occurrence char from current position |
cw | Change/replace to end of word |
c$ | Change/replace to end of line |
Keybinding | Description |
---|---|
aw | Select a word |
ab | Select a () block |
aB | Select a {} block |
ib | Select inner () block |
iB | Select inner {} block |
Keybinding | Description |
---|---|
/ followed by a regex, then RET | Search within current buffer |
? followed by a regex, then RET | Search backwards within current buffer |
n | Next occurrence in search |
N | Previous occurrence in search |
:%s/old/new/g | Search/replace old with new globally in buffer |
* | Search for next occurrence of word at cursor |
# | Search for previous occurrence of word at cursor |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
M-t l | SPC x t l | Transpose lines |
M-t w | Transpose words | |
M-t s | Transpose s-expressions | |
M-t p | Transpose params |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-s | SPC s b | Find next occurrence in buffer |
SPC s p | Search within project | |
C-r | Find previous occurrence in buffer | |
C-M-s | Find next occurrence using regex in buffer | |
C-M-r | Find previous occurrence in buffer |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-x b RET | SPC b b | Create a new/open recent buffer | |
C-x 4 b RET | Create a new buffer in new window | ||
C-x C-f | SPC f f | Open a file | |
C-x f | SPC f r | Open recent file | |
C-x k RET | SPC b d | Close buffer | |
SPC b R | Reload buffer | ||
C-x C-s | SPC f s | Save buffer | |
C-x C-w RET | SPC f s | Save buffer to file | |
C-c D | SPC f D | Delete current buffer & file | custom keybinding |
M-x | SPC : | Enable mode in file |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-x d | SPC a d | Open Dired |
< | Previous directory in listing (skips files) | |
> | Next directory in listing (skips files) | |
f | Open file | |
v | View file | |
^ | Go up to parent directory | |
d | Mark file for deletion | |
x | Delete files marked for deletion | |
q | Quit | |
+ | Create directory | |
= | Compare file at point with previously marked file | |
m | Mark a file for action | |
u | Unmark a file for action | |
t | Toggle marking | |
! <shell command string> | Run shell command on file at cursor |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-x 1 | SPC w m | Close all other windows except current window |
C-x 2 | SPC w s | Split current window horizontally |
C-x 3 | SPC w v | Split current window vertically |
C-x 0 | SPC w c | Close current window |
C-x o | SPC TAB | Switch to next window |
M-- C-x o | Switch to previous window | |
M- C-x o | Jump ahead # of windows | |
C-M-Shift-v | Scroll backward other window | |
C-M-v | Scroll forward other window | |
C-x { | Shrink window narrower | |
C-x } | Grow window wider | |
SPC w = | Balance split windows | |
SPC <window_num> | Jump to window number |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
S-<left> | Move to window to the left of current window | |
S-<right> | Move to window to the right of current window | |
S-<up> | Move to window above current window | |
S-<down> | Move to window below current window |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-x 5 1 | Close all other frames except current frame | |
C-x 5 2 | Split current frame horizontally | |
C-x 5 0 | Close current frame | |
C-x 5 o | Switch to next frame | |
C-x C-n | Create new frame |
Project navigation. An alternate prefix is Command-P.
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
M-S-o (default is C-c p f) | SPC p f | Open file in project with completion | Custom keybinding |
M-S-f (default is C-c p s s) | SPC p s | Search all files in project using regex | Custom keybinding |
M-e (default is C-c p e) | SPC p r | Show all recent opened files in project | Custom keybinding |
C-c p F | Open file in ANY project with completion | ||
C-c p r | Find/replace all files in project | ||
C-c p b | Show all open project buffers | ||
C-c p p | SPC p p | Switch between known projects | |
C-c p D | Open root project in dired | ||
C-c p k | Kill all buffers in project | ||
C-c p ! | Run shell on root of project as current dir | ||
C-c p p | Show all known projects |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
<f8> | SPC f t | Toggle project explorer |
RET | RET | Open file in main window |
# RET | Open file in window # | |
| | | | Open file in vertical split |
- | - | Open file in horizontal split |
C-c C-n | c | Create a new file or dir if filename ends with '/' |
C-c C-d | d | Delete a file or a directory |
C-c C-r | r | Rename a file or a directory |
g | gr | Refresh project explorer |
U | U | Go up one node in tree |
D | D | Go down one node in tree |
H | Previous sibling | |
L | Next sibling | |
A | TAB | Toggle widening explorer window |
S | H | Go to previous sibling node in tree |
s | L | Go to next sibling node in tree |
H | s | Toggle showing hidden files |
See https://github.com/magnars/multiple-cursors.el
Keybindings | Description | Notes |
---|---|---|
C-S-c C-S-c | Mark consecutive lines with multiple cursors | First select lines |
C-< | Mark previous occurrence of word | First select word |
C-> | Mark next occurrence of word | First select word |
C-c C-< | Mark all occurrences like selection |
Spacemacs Keybinding | Description |
---|---|
SPC ; | Comment to end of line |
SPC c l | Comment lines |
SPC c L | Invert Comment lines |
Keybinding | Spacemacs Keybinding | Description | IntelliJ IDEA |
---|---|---|---|
C-, | Auto-complete at point | M-SPC | |
C-x C-i | SPC s j | List definitions in file and jump | M-F12 |
C-c p c | SPC c C | Run compile on project | |
C-c p P | Run tests on project | ||
C-c p t | SPC p a | Toggle between implementation and test file |
Spacemacs Keybinding | Description |
---|---|
( and ) | Jump to beginning/end of paragraph |
{ and } | Jump to previous/next empty line |
[[ | Jump to previous } in column 0 |
]] | Jump to next } in column 0 |
Using base keybindings for paredit. Smartparens annoyingly hijacks various emacs keybindings in a way I don't like (e.g. M-DEL for kill word backwards)
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-M-b | Move backward one s-expression | Must be on a paren, otherwise behaves like backward word | |
C-M-f | Move forward one s-expression | Must be on a paren, otherwise behaves like forward word | |
C-M-d | Move down to next nested s-expression | ||
C-M-n | Move up s-expression | ||
C-M-u | Move up one level in nested s-expression | Requires fix for OSX interception of the keybinding (see http://emacs.stackexchange.com/a/20544/11397) |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
( | Wrap currently selected region with parens | Use with expand-region |
|
M-s | Remove parens immediately surrounding cursor point | ||
C-(,C-{ | Pull in or out previous word/s-expression into current s-expression | ||
C-),C-} | Pull in or out next word/s-expression into current s-expression | ||
M-<up> | Remove all chars before cursor point inside s-expression and surrounding parens | ||
M-<down> | Remove all chars after cursor point inside s-expression and surrounding parens | ||
M-r | Remove all chars around cursor point inside s-expression and surrounding parens | ||
M-S | Split current s-expression into two separate ones with cursor as split point | ||
C-M-t | When cursor is placed between s-expressions, swaps (transposes) their positions |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-c RET | clj refactor prefix | See commands | |
M-x clojure-cheatsheet | Clojure command cheatsheet |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-c M-j | Cider jack-in, opens nREPL in a clojure project | ||
C-c C-k | Load (eval) the current buffer | ||
C-c C-e | Eval form before current cursor position | ||
C-c C-v v | Eval form around current cursor position | ||
C-c C-v r | Eval the region and display result in echo area | ||
C-c C-v n | Eval the entire current namespace | ||
C-c C-z | Switch the REPL buffer | ||
C-c M-z | Load (eval) the current buffer and switch to the REPL buffer | ||
C-c M-n | Switch the namespace of the REPL buffer to the namespace of the current buffer | ||
C-c C-x | Reload all modified files on the classpath | ||
C-c C-t n | Run tests in current ns | ||
C-c C-t t | Run a test at the cursor position | ||
C-u C-M-x | Start debug session | ||
C-c C-d d | Display doc string for the symbol at point | ||
C-c C-. | Jump to some namespace on the classpath | ||
, | Once repl is open, get command keybindings | ||
C-c C-q | Quit current REPL session |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-x m | SPC g s | See current git status/changed files |
g | Reload status buffer | |
c c, <write message>, C-c C-c | c c, <write message>, C-c C-c | Commit file |
P u | P u | Push changes to remote |
F u | F u | Pull latest changes |
s | Stage file | |
u | Unstage file | |
b b | Switch branch | |
navigate to file, then TAB | Version diff | |
k | revert changes | |
l l | Show log | |
b | Switch to branch | |
B | Create a new branch | |
z | Stash changes | |
A | Unstash changes | |
I | Exclude file(s) | |
M-x magit-clone | Clone a repo | |
q | q | Quit |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-z | Open eshell | |
M-p | Go back in command history | |
M-n | Go forward in command history | |
C-c C-r | Clear the shell buffer | |
M-r | search backwars in command history with regex | |
M-s | search forward in command history with regex | |
!! | Repeats the last command | |
!ls | Repeats the last commnd starting with ls |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-c C-p | Move up a heading | |
C-c C-n | Move down a heading | |
C-c C-b | Move up a heading, same level | |
C-c C-f | Move down a heading, same level | |
TAB | Toggle heading open/closed states | |
S-TAB | Toggle entire buffer heading open/closed states | |
M-<down> | Move heading down | |
M-<up> | Move heading up | |
M-<left> | Promote heading | |
M-<right> | Demote heading | |
C-RET | New heading | |
M-RET | New list item entry | |
/ | Search inside org mode | |
C-c - | Cycle item type | |
S-, S- | Cycle state of TODO item |
Keybinding | Spacemacs Keybinding | Description |
---|---|---|
C-c | | Convert active region into a table | |
C-c C-c | Re-align table | |
TAB | SPC m t l | Re-align the table and move to the next field |
S-TAB | SPC m t h | Re-align the table and move to the previous field |
| RET | SPC m t i c | Insert new column to the right |
RET | RET | Re-align the table and move to the next row |
C-c SPC | SPC m t b | Blank the table cell at cursor |
C-c - | SPC m t i h | Insert a horizontal rule on next line |
M-<left> | SPC m t H | Move column at cursor to the left |
M-<right> | SPC m t L | Move column at cursor to the right |
M-S-<left> | SPC m t d c | kill current column |
M-S-<right> | SPC m t i c | Insert a new column to the left of the cursor |
M-S-<up> | SPC m t d r | Kill the current table row |
M-S-<down> | SPC m t i r | Insert new row above current row |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
M-x describe-key | SPC h d k | Tell which function is bound to key combo | |
C-h b | SPC ? | All active keybindings with flx-ido narrowing | Custom keybinding |
C-h a <topics> RET | Search help system for matches to | ||
type key prefix and wait 1 sec | type key prefix and wait 1 sec | Get remaining completion options | via which-key |
C-h m | Display documentation of the current major mode | ||
C-h f | Run help-apropos , an interactive version of apropos-command |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-c z C-s | Save current session for workgroup | ||
C-c z C-f | Load a session for a given workgroup | ||
C-c z c | Create a new workgroup | ||
C-c z v | Switch to a workgroup |
Reference: http://ddloeffler.blogspot.ca/2013/04/keybindings-for-emacs-markdown-mode.html
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
C-c C-t h | Create heading | ||
C-c C-a l | Create link | ||
C-c C-a L | Create anchor link | ||
C-c C-s e | Italisize selection/region | ||
C-c C-s s | Bold selection/region | ||
C-c - | Horizontal rule |
Keybindings for use inside the minibuffer.
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
TAB | Auto-complete as much as possible | ||
SPACE | Complete up to one word | ||
RET | Complete and execute | ||
? | Show completion possibilities | ||
M-r | Regex search backward through command history | ||
M-s | Regex search forward through command history | ||
C-g or Esc Esc Esc | fd | Abort current command |
Keybinding | Spacemacs Keybinding | Description | Notes |
---|---|---|---|
M-x ediff | Diff Files | ||
C-x v = | View diff of current file | ||
M-x procd | View processes (like top) | OR C-x p (with global keybinding) | |
C-x d | File browser (dired) | ||
C-x g | Search in Web hooks | custom binding | |
C-c u | View URL | ||
C-x C-f /remotehost:filename RET | TRAMP remote file editing | Open a directory to get a Dired buffer! | |
M-$ | Check and fix spelling at cursor |