Skip to content

Instantly share code, notes, and snippets.

@robphoenix
Last active June 10, 2024 08:16
Show Gist options
  • Save robphoenix/9e4db767ab5c912fb558 to your computer and use it in GitHub Desktop.
Save robphoenix/9e4db767ab5c912fb558 to your computer and use it in GitHub Desktop.
[DEPRECATED] Spacemacs Cheat Sheet - Visit https://github.com/Ben-PH/spacemacs-cheatsheet
  • SPC b b - Helm mini; lists buffers & recent files

    • CTRL SPC - Mark Items
    • CTRL z - Actions
  • SPC b B - ibuffer

  • SPC f f - open files

    • CTRL h - up a folder
    • CTRL l - open a folder
    • CTRL j - up
    • CTRL k - down
  • SPC p f - opens root of project

  • SPC p p - opens projects

  • SPC / - searches through project

  • SPC s s - search in a file

  • SPC s l - find all function definitons in a file

  • SPC v - expand region

  • SPC V - contract region

  • s ( - put parens around a region

  • SPC s e - multiple cursors

    • n - jump
    • N - jump
  • SPC h d - help describe

  • SPC h d f - help describe functions

  • SPC h d v - help describe variables

  • SPC f e h - help

  • ALT / - snippet completion

  • SPC t s - syntax checking

  • SPC e - syntax checking options

  • SPC a r - ranger

  • SPC a d - deer

unimpaired

  • [e - Move line up
  • ]e - Move line down
  • [SPACE - Insert space above
  • ]SPACE - Insert space below
  • [p - Paste above current line
  • ]p - Paste below current line

evil-mc

  • grm - make-all-cursors
  • gru - undo-all-cursors
  • grs - pause-cursors
  • grr - resume-cursors
  • grf - make-and-goto-first-cursor
  • grl - make-and-goto-last-cursor
  • grh - make-cursor-here
  • M-n - make-and-goto-next-cursor
  • grN - skip-and-goto-next-cursor
  • M-p - make-and-goto-prev-cursor
  • grP - skip-and-goto-prev-cursor
  • C-n - make-and-goto-next-match
  • grn - skip-and-goto-next-match
  • C-t - skip-and-goto-next-match
  • C-p - make-and-goto-prev-match
  • grp - skip-and-goto-prev-match

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
  • SPC f f - find a file
  • SPC f s - save a file (:w also works)
  • SPC p p - open project
  • SPC p h - find a file in current project
  • SPC b d - kill current buffer
  • SPC b M - move buffer to another window
  • SPC v - enter expand-region mode

Useful Vim key bindings

movement

  • 0 - beginning of line
  • ^ - beginning of non-whitespace
  • $ - end of line
  • 9j - move down 9 lines
  • w - move forward by word
  • b - move backward by word
  • gg - first line
  • G - last line
  • C-u - up half page
  • C-d - down half page
  • f/ - move forward to first "/" character
  • t/ - move forward right before the first "/" character
  • ; - repeat that command again
  • H - head of the screen
  • M - middle of the screen
  • L - last of the screen
  • } - move forward by paragraph or block
  • { - move backwards by paragraph or block
  • * - search for word under the cursor
  • n - search again forward
  • N - search again backwards
  • # - search backwards for word under cursor
  • / - search forward
  • ? - search backward
  • % - find matching brace, paren, etc
  • ma - mark a line in a file with marker "a"
  • ``a` - after moving around, go back to the exact position of marker "a"
  • 'a - after moving around, go back to line of marker "a"
  • :marks - view all the marks
  • '' - go to the last place you were

editing

  • x - delete char under cursor
  • X - delete char before cursor
  • A - add to end of line
  • I - insert at the beginning of the line
  • dd - delete line
  • D - delete from cursor to end of line
  • di' - delete text inside single quotes
  • yy - copy line
  • Y - copy from cursor to end of line
  • cc - change line
  • C - change from cursor to end of line
  • cit - change text inside html tag
  • ci' - change text inside single quotes
  • ci{ - change text inside curly brackets.
  • ci... - etc
  • p - paste after cursor
  • P - paste before cursor
  • o - add line below
  • O - add line above
  • . = repeat last comment
  • r - replace character
  • R - replace. (overwrite) (good for columns of text)
  • J - join line (cursor can be anywhere on line)

visual mode

  • v - visual char mode
  • V - visual line mode
  • C-v - block visual mode
@cjpoor
Copy link

cjpoor commented Oct 24, 2016

SPC w c has been replaced by SPC w d

@manskron
Copy link

This is great! Thank you very much for putting it together.

@somallg
Copy link

somallg commented May 14, 2018

nice one, exactly what i need to migrate from vim to spacemacs

@sirb0rab0g1
Copy link

how to if you have multiple lines to space?

@grapefroot
Copy link

You can search for hotkeys by using SPC ?

@hiraksarkar
Copy link

Please add SPC f e d

@BrianZbr
Copy link

BrianZbr commented Jan 5, 2019

Thanks, this looks helpful! The Git section is tough to read though, did you mean to leave out the bullet points for some reason?

@0xd61
Copy link

0xd61 commented Feb 21, 2019

This is great! You could also add fd to vim to quickly switch from insert mode to normal mode.

@robphoenix
Copy link
Author

Heyyy, I didn't realise this had any stars or comments! Thanks πŸ™
I haven't used Spacemacs in a couple years now, so haven't been updating this, and probably won't I'm afraid. Maybe someone wants to link to a more up to date fork or repo that is being maintained? πŸŽ†

Also, apologies for the Git section, it doesn't have any formatting, I got tired/lazy and never got round to fixing it.

@danilevy1212
Copy link

Maybe you could add C-j for inserting a breakline right before the cursor in editing section, recently discovered it and its super useful for breaking long lines up.

@Ben-PH
Copy link

Ben-PH commented Aug 27, 2019

Heyyy, I didn't realise this had any stars or comments! Thanks pray
I haven't used Spacemacs in a couple years now, so haven't been updating this, and probably won't I'm afraid. Maybe someone wants to link to a more up to date fork or repo that is being maintained? fireworks

Also, apologies for the Git section, it doesn't have any formatting, I got tired/lazy and never got round to fixing it.

@robphoenix Given how much it's taken off, with all the likes and forks, I've made a github repo based on this.
https://github.com/Ben-PH/spacemacs-cheatsheet

The initial commit is a copy paste of this, but with a general cleanup, particularly in the Git section.

Feel free to have the link at the top of the gist. I do plan to keep it maintained, take PRs, etc.

@robphoenix
Copy link
Author

Great, thanks @Ben-PH, I've added a link πŸ‘ πŸŽ‰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment