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- quitSPC w /- split window verticallySPC w -- split window horizontallySPC w d- delete current windowSPC b b- switch buffersSPC f f- find a fileSPC p p- open projectSPC p f- find a file in current projectSPC b d- kill current bufferSPC b b- Helm mini; lists buffers & recent filesSPC /- searches through projectSPC s s- search in a fileSPC s e- multiple cursorsALT /- snippet completionSPC e- syntax checking options
Magit Commands
SPC g s- show git statusSPC g b- open a magit blameSPC g t- launch the git time machine
In Magit Window
C-c C-c- show help textl l- log current branchd s- show diff of staged changesd u- show diff of unstaged changess- stage a file or changeu- unstage a file or changec c- create a new commitc a- amend a commitr e- rebase elsewhere (normally on master)r -i e- rebase interactively elsewhereb b- checkout a branchb c- create a branchf f- fetch changesF (r) u- pull tracked branch and rebaseg r- refresh
Useful Vim key bindings
Movement
0- beginning of line^- beginning of non-whitespace$- end of linew- move forward by wordb- move backward by wordg g- first lineG- last lineC-u- up half pageC-d- down half pageH- head of the screenM- middle of the screenL- last of the screen}- move forward by paragraph or block{- move backwards by paragraph or blockn- search again forwardN- search again backwards#- search backwards for word under cursor/- search forward?- search backward%- find matching brace, paren, etcma- 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 cursorX- delete char before cursorA- add to end of lineI- insert at the beginning of the linedd- delete lineD- delete from cursor to end of linedi'- delete text inside single quotesyy- copy lineY- copy from cursor to end of linecc- change lineC- change from cursor to end of linecit- change text inside html tagci'- change text inside single quotesci{- change text inside curly brackets.ci...- etcp- paste after cursorP- paste before cursoro- add line belowO- add line above . = repeat last commentr- replace characterR- 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 modeV- visual line modeC-v- block visual mode