Useful Spacemacs Commands
I have been using spacemacs for a few years now and I wanted to make a quick list of helpful commands.
Basic Spacemacs commands
- SPC q q- quit
- SPC w /- split window vertically
- SPC w -- split window horizontally
- SPC w d- delete current window
- SPC b b- switch buffers
- SPC f f- find a file
- SPC p p- open project
- SPC p f- find a file in current project
- SPC b d- kill current buffer
- SPC b b- Helm mini; lists buffers & recent files
- SPC /- searches through project
- SPC s s- search in a file
- SPC s e- multiple cursors
- ALT /- snippet completion
- SPC e- syntax checking options
Magit Commands
- SPC g s- show git status
- SPC g b- open a magit blame
- SPC g t- launch the git time machine
In Magit Window
- C-c C-c- show help text
- l l- log current branch
- d s- show diff of staged changes
- d u- show diff of unstaged changes
- s- stage a file or change
- u- unstage a file or change
- c c- create a new commit
- c a- amend a commit
- r e- rebase elsewhere (normally on master)
- r -i e- rebase interactively elsewhere
- b b- checkout a branch
- b c- create a branch
- f f- fetch changes
- F (r) u- pull tracked branch and rebase
- g r- refresh
Useful Vim key bindings
Movement
- 0- beginning of line
- ^- beginning of non-whitespace
- $- end of line
- w- move forward by word
- b- move backward by word
- g g- first line
- G- last line
- C-u- up half page
- C-d- down half page
- 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
- 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 line of marker “a”
- :marks- view all the marks
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)
- :edit!- reload the file
Visual mode
- v- visual char mode
- V- visual line mode
- C-v- block visual mode
