SPC q qquitC-gabort actionSPC w /split window verticallySPC w- split window horizontallySPC w cdelete current windowSPC f ffind a fileSPC f ssave a file (:w also works)SPC p hfind a file in current projectSPC b dkill current bufferSPC b Mmove buffer to another windowSPC v- enter expand-region modeSPC s lfind all function definitons in a filenNjump
SPC h dhelp describeSPC h d fhelp describe functionsSPC h d vhelp describe variablesSPC f e hhelpM-/snippet completionSPC t ssyntax checkingSPC esyntax checking optionsSPC a rrangerSPC a ddeer
9jmove down 9 lineswb- word forward/backward0$^line beginning/end/first-non-whitespaceHMLwindow goto head/middle/lastggGbuffer line first/lastC-uC-dwindow half up/downC-bC-fwindow up/downggGbuffer top/last line()sentence{}paragraph%matching brace, paren, etcftFTfind char forward/one before/backward/one after (enter desired character after this prefix)f/forward to first “/” charactert/forward right before the first “/” character
;- repeat last find''last place you were in history
https://www.spacemacs.org/layers/+tools/imenu-list/README.html
SPC bifocus imenu tree sidebar (creating if necessary)SPC Titoggle imenu tree sidebarSPC jijump in buffer (helm imenu)qquit imenu-list windowrrefresh imenu-list windowdRETdisplay/goto current entry, keep/abandon focusffold/unfold current section
SPC 1switch to window 1SPC 2switch to window 2
SPC TABswitch to previous bufferSPC b bswitch buffersSPC b BibufferSPC s ssearch in a file
SPC p popen projectSPC /searches through project
mmark a line in a file with marker char that followsma- mark a line in a file with marker “a”
`'go to exact position/line of marker char that follows`a'aafter moving around, go back to the exact-position/line of marker “a”
:marksview all marksevil-marksC-SPC C-SPCmarkC-u C-SPCgo to last mark in the ring , cycles last 16 marks
SPC a o rhelm-org-rifleopen org buffershelm-org-rifle-directoriesselected dirs; (with prefix: recursively)helm-org-rifle-filesselected fileshem-org-rifle-org-directoryin org-directory
M-m wwother window, followed byM-m wbswitch to minibuffer window
/?*#search forwards/backwards/word forwards/word backwardsnNsearch again forwards/backwardsSPC h cclears highlight
C-SPCmark itemsM-aselect all itemsM-ghelm-ff-run* functionsC-zactionsC-hC-lC-kC-jup/down tree/selectionSPC rlresume last helm sessionSPC a'available repls
SPC N hjklHJKLbfgG transient scroll line/half-page/full-page/buffer
SPC z .transient state for folding codezczozmzrfold/open current/all in buffer
SPC cdshow/hide compilation window
vorC-vorV- select block/regionSPC vexpand regionSPC Vcontract regionvigselect all in bufferviwvawinner/a word
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)
C-v jjj grI <edit text> grqedit multiple lines at once
SPC se*eedit all occurences of symbol under cursorTABnNoccurence toggle/next/previousfrestrict the scope to functionsixsubstitute/insert/xterminateESC
M-/- paste template e.g.q M-/for q source code block in org-mode. powered byyas-hippie-try-expandSPC SPC yas-visit-snippet-fileview/edit templates
M-;comment indent
dawcawvawword under cursor delete/change/visual select; usesevil-a-wordM-%- query-replace; active region, or cursor point to end interactive find/replacey- do the replacement.n- skip!- do this and all remaining replacements without asking.C-g- cancel.
SPC se*eiedit state (after you selected region); thenssubstitute and type desired replacement- opening/closing parenthesis means with/without space
- start with one of
y,d,c,v,V, thensthen optionali,s,fthen any symbol to use as surroundvs(put parens around a regionvs}surround the selection with curliescs]{change surrounding brackets with curlies including spaceds{delete surrounding curliesyss)wrap entire line in parenthesesysiw]wrap word with bracketsVs<p class "important">RETwrap with custom tagsvsfmyfunctionRETwrap with myfunction()
[e- Move line up]e- Move line down[SPC- Insert space above]SPC- Insert space below[p- Paste above current line]p- Paste below current line
https://practicalli.github.io/spacemacs/spacemacs-basics/evil-tools/multiple-cursors.html
grjgrkmake cursor move next/prev linegrq- quitgrm- make all cursorsgru- undo all cursorsgrs- pause cursorsgrr- resume cursorsgrh- make cursor heregrlgrf- make and goto last/first cursorM-pM-nC-pC-n- make and goto prev/next cursor/matchgrPgrNgrpgrnC-t- skip and goto prev/next cursor/match
SPC w rSPC w Rrotate windows forward/backward
gt- go to next workspacegT- go to previous workspaceSPC l w n- create or switch to workspace nSPC l w TAB- switch to last active workspaceSPC l w c- close current workspaceSPC l w norSPC l w l- switch to next workspaceSPC l w NorSPC l w porSPC l w h- switch to previous workspaceSPC l w r- set a tag to the current workspaceSPC l w w- switched to tagged workspace
SPC g .version control transient stateSPC g bopen a magit blameSPC g Bquit magit blameSPC g ccommit changesSPC g Ccheckout branchesSPC g dshow diff promptSPC g Dshow diff against current headSPC g eshow ediff comparisonSPC g Eshow ediff against current headSPC g fshow fetch promptSPC g Fshow pull promptSPC g H cclear highlightsSPC g H hhighlight regions by age of commitsSPC g H thighlight regions by last updated timeSPC g igit init a given directorySPC g Iopen helm-gitignoreSPC g lopen a magit logSPC g Ldisplay the log for a fileSPC g Pshow push promptSPC g sopen a magit status windowSPC g Sstage current fileSPC g mdisplay the last commit message of the current lineSPC g tlaunch the git time machineSPC g Uunstage current file
http://ndpsoftware.com/git-cheatsheet.html
git checkout yourBranch
git reset $(git merge-base master yourBranch)
git add -A
git commit -m "one commit on yourBranch"git config --global pull.rebase true why use it, or at least git pull -r https://mergebase.com/blog/doing-git-wrong/
https://develop.spacemacs.org/layers/+source-control/version-control/README.html
SPC g rSmerge mode transient state
SPC f ssave buffer to upload to github.com
RETopens the gist in a new buffergreload the gist list from servereedit the gist description, so you know what this gist is aboutkdelete current gistbopens the gist in the current web browseryshow current gist url & copies it into the clipboard*star gist (stars do not show in gist list, only when browsing them on github)^unstar gistffork gist - create a copy of your gist on gist.github.com+add a file to the current gist, creating an additional snippet on the gist-remove a file from the current gist
m @mark file, make public gist (private if used with prefix)
grrefresh$open command output bufferc copen a commit message bufferl lopen log bufferb bb cbranch checkout/createf ffetch changesF (r) upull tracked branch and rebaseP uP mpush to branch: tracked/matching (e.g., upstream/develop to origin/develop)jkgoto magit section next/prevC-jC-kvisual line next/prev/evil-searchnNsearch occurrence next/prevorevert item at pointsSstage the file or hunk / stage allxdiscard changes+-on a hunk: increase/decrease hunk sizeTABxpand/collapse diff (on a file)uUunstage staged file / allz zstash changes
- compare two revs/commits
-
a)
d r, START,.., END ,RET- use completion withTABto populate START and ENDb)
l, mark the start/end commits as region,d d - Stage specific lines
- select* them in a diff and hit
sto stage (Vwill stage one more line than intended - usevinstead) - Amend a commit
-
l lto open log bufferc aon the commit you want to amend,corC-c C-cto submit the changes
- Squash last commit
- http://www.howardism.org/Technical/Emacs/magit-squashing.html
l lto open log bufferr eon the second to last commit, it opens the rebase bufferjto put point on last commitsto squash it,corC-c C-cto continue to the commit message buffer,corC-c C-cagain when you have finished
to edit the commit message
- Force push a squashed commit
-
- in the status buffer you should see the new commit unpushed and the old commit unpulled
P -f Pfor force a push (beware usually it is not recommended to rewrite the history of a public repository, but if you are sure that you are the only one to work on a repository it is ok - i.e. in your fork).
- Add upstream remote (the parent repository you have forked)
-
Mto open the remote popupato add a remote, type the name (i.e. upstream) and the URL
- Pull changes from upstream (the parent repository you have forked) and push
-
b usetbranch.master.remotetoupstreamF ufetch upstreamb bcheckout (master) branchm mmerge (upstream/master)- (old way?) -
F -r C-u Fand choose upstream or the name you gave to it P Pto push the commit to origin
- Tag
-
t rthenP t
corppickeeditffixupgjmove line downgkmove line updorxkill linerrewordssquashuundoyinsert!execute
git-timemachine allows to quickly browse the commits of the current buffer.
SPC g tstart git timemachine and initiate micro-statecnNpshow current/next/previous/previous commitYcopy current commit hash
SPC f f C-c r edit file as root
grevert/refreshmdu<backspace>MUmark/unmark at point/alloomit (filter out) marked
https://www.masteringemacs.org/article/displaying-interacting-processes-proced
Ttree view, showing children and parentsFcolumn selectionffilter rowsRETfilter on pointtinvert marksCPmark childrenssortkxsend signal (TERM by default)?review the log after sending signalrrenice command
| Shortcut | Action |
|---|---|
| TAB | Create a new table or move to the next field |
| RET | Move to the next row |
| Shortcut | Action |
|---|---|
| M-LEFT | Move column left |
| M-RIGHT | Move column right |
| M-UP | Move row up |
| M-DOWN | Move row down |
| C-c - | Insert a horizontal line |
| Shortcut | Action |
|---|---|
| C-c TAB | Realign the table |
| C-c ^ | Sort the table |
| Shortcut | Action |
|---|---|
| C-c + | Sum numbers in a column/region |
| C-c ` | Edit field in separate window |
| C-c } | Narrow table to column |
| C-c { | Widen table |
| Shortcut | Action |
|---|---|
| C-c C-c | Export table to different format |
- Table editing in Org-mode is context-sensitive. The shortcuts only work when the cursor is within a table.
- To add rows or columns, simply move to where you want the new row or column and start typing.
- Use TAB to cycle through fields and create new rows.