Your browser does not support JavaScript!
Upvotes Anonymous 23 User 0

Spacemacs (Vim mode) Cheatsheet

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
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/<find text>/<replace text>/gc
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 <first letter of word>
Jump back   ctrl o
Create/jump to a named bookmark   SPACE h b
Center the buffer around your cursor   z z
Go to the last place you edited   g ;
Go to the file path under your cursor   g f
Window Layouts
Split window vertically   SPACE w S
Switch to other window   SPACE <number of window>
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 <number of layout>
Highlight Text with Visual Mode
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)
Was this helpful?


Byanonymous Anonymous 0 User 0
Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us.
Byanonymous Anonymous 0 User 0
thanks this is actually the most helpful documentation on spacemacs I've seen and and trawled through a lot
Byanonymous Anonymous 0 User 0
Thanks a lot for this. I've created a cheatsheet with most of the commands listed here + some additional ones. Here it is if anyone wants to have a look:
Byanonymous Anonymous 0 User 0
Great post. This is easily one of the best cheat sheets on spacemacs!
Byanonymous Anonymous 0 User 0
There are some deprecated key bindings like `SPC w S` it should be `SPC w v` instead to split vertically.
Byanonymous Anonymous 0 User 0
Byanonymous Anonymous 0 User 0

Leave a Comment

I agree to the Terms of Service
Design © 2015, Downranked, LLC.,
Original user code contributions under MIT License