This reference is available in: pdf odt
For project searching, create an empty file named .projectile in your project root directory. For text searching, install AG (the silver searcher) and create an .agignore file to avoid searching certain directories. When searching for files or text in Spacemacs, you can use ctrl-j to go down, ctrl-k to go up, and page up/down.
This sheet assumes you’re using the VIM mode of Spacemacs. When you open a file, you will be in the command mode of the editor. The command mode is not an edit mode; it's just for typing commands. Insertion mode is where you can type text normally (e.g. like in Microsoft Word).
To get into insertion mode, type i (abbreviation for insert) or a (insert after the cursor). To get back into command mode, press the Esc key or rapidly press f d.
If you're ever not sure which mode you're in, just press the Esc key to get into command mode. The below commands are executed in command mode.
Quit SPACE q q
Increase/decrease font size SPACE z x
Open a file SPACE f f (then ctrl h to go up a directory, TAB for completion)
Save a file SPACE f s
Create a file SPACE f f <type in the new file path, press enter, it will ask to create a file>
Find a file in your project SPACE p f
Edit the .spacemacs config file SPACE f e d
Switch to a file recently opened SPACE b b
Find text in buffer / (type search text, press ENTER, followed by n or N (next/previous))
Find next instance of a word that your cursor is over *
Find previous instance of a word that your cursor is over #
Turn off previous search highlighting :nohl (then press ENTER)
Find text in project SPACE /
Find text under cursor in project (or selected with visual-mode) SPACE *
Resume last search SPACE s l
Find and replace text in buffer, from current line :.,$s/
Go up k
Go down j
Go left h
Go right l
Go down a page ctrl d
Go up a page ctrl u
Go up to next paragraph (whitepace line) {
Go down to next paragraph (whitepace line) }
Go to previous function [[
Go to next function ]]
Go up to outer brace [{
Go down to outer brace ]}
Go right a word w
Go to the end of a word e
Go left a word b
Go to beginning of file gg
Go to end of file G
Go 22 lines down 22j
Go to end of line $
Go to beginning of non-whitespace part of line ^
Go right 5 words 5w
Jump to any word SPACE SPACE
Split window vertically SPACE w S
Switch to other window SPACE
Close a window SPACE w c
Show/hide layout help SPACE l ? (make sure to close the help before creating or saving layouts)
Create a named layout SPACE l l
Save a layout by name SPACE l S
Switch to layout SPACE l
Press v. (To enter visual mode so you can highlight text). Use the arrow keys (or h,j,k,l,w,b,$) to highlight.
Undo u
Redo ctrl-r
Comment out a line g c c (requires the evil-commentary layer)
Comment out highlighted text g c
Copy highlighted text Press y to yank, p to paste. (shift-p to open up a line above and paste)
Copy a word yw
Copy a line yy
Copy from cursor to end of line y$
Copy & paste highlighted text from a register Type "ay to yank into register a, and "ap to paste.
Delete highlighted text d
Delete character x
Delete word dw
Delete word and insert text cw
Delete line dd
Delete to end of line d$
Delete until right paren df)
Change everything between quotes c i “ (this also works for parens, single quotes, etc.)
Show previous things you’ve copied (yanked) SPACE r y
Indenting highlighted text Type > or < to indent right or left. (to indent more, type 2> or 3>)
Join lines separated by whitespace J
Show whitespace SPACE t w
Convert spaces to tabs SPACE : (then type tabify and press ENTER)
Convert tabs to spaces SPACE : (then type untabify and press ENTER)
Amazing, thank you very much.
Leave a comment