Skip to content

Latest commit

 

History

History
414 lines (371 loc) · 21.6 KB

survival_guide.org

File metadata and controls

414 lines (371 loc) · 21.6 KB

Emacs survival guide

Emacs Survival Guide

Notation:

C means Control, S means SHIFT, M means Alt (Meta)

For example, C-x means hold down the Control key while typing x.

Boon

Command-mode

commandaction
vSwitch to Insert-mode
jmove by word to the left
;move by word to the right
kmove by character backward
lmove by character forward
imove up by line
omove down by line
ustart of line
pend of line
Kmove backward by sentence
Lmove forward by sentence
Imove backward by paragraph
Omove forward by paragraph
d ldelete character to the right
d kdelete character to the left
d jdelete word to the right
d ;delete word to the left
d SPACEdelete line
d regiondelete region
d <number> actiondelete times action, i.e. d 4 l delete four character to the left
`toggle case between Capitalcase and lowercase. Works with regions
q <character>insert character
t <character>change character under cursor to character
wshow word-count, and—if tracktable present—words written towards goal
nnarrow to subtree
Nwiden view (un-narrow)
Mtoggle Doom modeline
stoggle centered writing-mode where the cursor stays in the middle

Insert-mode

commandaction
C-;Switch to Command-mode

Regular

Navigate

normalboonaction
C-f / C-bk / lmove forward/backward by character
M-f / M-bj / ;move forward/backward by word
C-n / C-po / imove forward/backward by line
C-a / C-eu / pgo to line beginning/end
M-a / M-eK / Lgo to sentence beginning/end
M-{ / M-}I / Ogo to paragraph beginning/end
C-x [ / C-x ]go to page beginning/end
M-< / M->< / >Move to document start / end
C-v-none-scroll to next screen
M-v-none-scroll to previous screen
C-M-pscroll-down-line
C-M-nscroll-up-line
C-l-none-scroll current line to center, top, bottom
M-rreposition cursor to center, top, bottom
M-mgo to first non-whitespace on line, forward or backward

Editing

Files

normalboonaction
C-x C-fFind and open an existing file, or create a new file
C-x dOpen directory
C-c rOpen recently opened file
C-x C-rFind and open file read-only
C-x iInsert file
C-x C-sSave file
C-x C-wSave file as
C-x C-cExit Emacs

Formatting

normalboonaction
C-jperform ENTER followed by TAB
C-oinsert blank line
C-q C-lInsert page break
C-x C-oremove all blank lines except one
M-\delete all white space around point
M-x canonically-space-regionfix up spacing and casing in region

Case change

normalboonaction
M-uupcase word
M-llowercase word
M-ccapitalize word
M– M-lConvert last word to lower case. Note ‘Meta–’ is Meta-minus.
M– M-uConvert last word to all upper case.
M– M-cConvert last word to lower case with capital initial.
C-x C-uuppercase region
C-x C-llowercase region

Search and replace

normalboonaction
M-%Search and replace

Frames and Windows

normalboonaction
C-x 1x 1delete other windows
C-x 2x 2split window, above and below
C-x 3x 3split window, side by side
C-M-vscroll other window
C-x ox oswitch cursor to another window
C-x 4 bx 4 bselect buffer in other window
C-x 4 C-ox 4 C-odisplay buffer in other window
C-x 4 fx 4 ffind file in other window
C-x 4 dx 4 drun dired in other window
C-RIGHTgrow window narrower
C-LEFTgrow window wider
C-DOWNmake window taller
C-UPmake window smaller
M-x follow-modetoggle follow mode
C-x 4 0x 4 0kill current buffer and delete window

Other

Transposing

normalboonaction
C-ttranspose two characters
M-ttranspose two words
C-x C-tx C-ttranspose two lines
M-x tstranspose sentences
M-x tptranspose paragraphs

Read-only mode

normalboonaction
C-x C-qx C-qToggle read-only mode

Numeric argument

normalboonaction
C-u numnumrepeat following instruction num times

Abbrevs

normalboonaction
C-x a gx a gAdd global abbrev
C-x a lx a lAdd local abbrev
C-x a i gx a i gAdd global inverse abbrev
C-x a i lx a i lAdd local inverse abbrev

Spell check

normalboonaction
F12spellcheck buffer
S-F12spellcheck word
iadd word to private dictionary
rchange word
askip word for this session
SPACEskip word
xend spellchecking session
qabort spell checking session
C-hshow options screen for spellchecking session
M-x ispell-change-dictionarychange current dictionary

Tabs

normalboonaction
C-jperform ENTER followed by TAB
M-iindent from the point to the next TAB-point

Killing and deleting

normalboonaction
C-wdkill region
M-wDcopy region to kill buffer
C-yyyank back last thing killed
M-yreplace last yank with previous kill, cycle kill ring
M-z charzap to char

Marking

normalboonaction
C-@ / C-SPACESPACEset mark here
C-x C-xExchange mark and point
M-@mark arg words away
M-hmark paragraph
C-x hx hmark entire buffer

Narrowing

normalboonaction
C-x n bx n bnarrow to block
C-x n ex n enarrow to element

Undo / Redo

normalboonaction
C-x uundo
C-g C-x uredo
C-/undo
C-g C-/redo
M-x revert-bufferrevert buffer to its original contents

Registers

normalboonaction
C-x r sx r ssave region in register
C-x r ix r iinsert register contents into buffer
C-x r SPACEx r SPACEsave value of point in register
C-x r jx r jjump to point saved in register
C-x r wx r wsave window configuration in register
C-x r mx r mset bookmark
C-x r bx r bjump to bookmark
C-x r lx r lvisit bookmark list buffer

Keyboard Macros

normalboonaction
F3record keyboard macro
F4end record keyboard macro / run keyboard macro

Counting words

normalboonaction
M-x count-wordscount words in region
M-x count-words-regioncount words in whole buffer

Magit

normalboonaction
C-x grun Magit
sstage
uunstage
krevert
c ccommit
C-c C-cc cExecute commit, after having written the commit message
P ppush
F ppull
hshow Magit keyboard commands
qexit Magit

Draftmode

normalboonaction
M-x draft-modeTurn on draft-mode

Yasnippet

normalboonaction
TABexpand snippet
C-c & nnew snippet
C-c & C-vvisit snippet file

Transparency

normalboonaction
C-c t stoggle transparency

Zoom

normalboonaction
C-x C-+Zoom in / make the text larger
C-x C–Zoom out / make the text smaller
C-x C-0Reset zoom level

Org-roam

normalboonaction
C-c n ffind node, or insert new node
C-c n iinsert link to node
C-c n Iinsert link to node, without creating a node
C-c n pfind project
C-c n tcapture task
C-c n bcapture inbox
C-c n droam dailies

Org-tracktable

normalboonaction
M-x tt-insertinsert tracktable
Mx-tt-updatewrite new tracktable entry
M-x tt-statuswshow tracktable status

Hint: use C-c & to get back to where you were prior to updating the tracktable. Use tag nowc or noexport tags for the headings which content you do not want to be counted by the tracktable.

Deft

normalboonaction
C-c n drun deft
C-c C-qquit deft

Org-mode

Visibility

normalboonaction
TABrotate current subtree between states
S-TABrotate entire buffer between states
C-c C-x C-vc TABtoggle visibility of inline images

Navigate

normalboonaction
C-c C-n/pc n/pnext/previous heading
C-c C-f/bc f/bnext/previous heading, same level
C-c C-uc ubackward to higher level heading
C-c C-jjump to another place in document

Edit

normalboonaction
M-RETinsert new heading/item at current level
C-RETinsert new heading after subtree
C-c -turn line into item, cycle item type
C-c *turn item/line into headline
M-LEFT/RIGHTpromote/demote heading
M-S-LEFT/RIGHTpromote/demote current subtree
M-UP/DOWNmove subtree item up/down
C-c C-x cclone a subtree
C-c C-x vcopy visible text
C-c C-x C-w/M-wkill/copy subtree
C-c C-x C-y or C-yyank subtree

Marking

normalboonaction
M-hmark the element at point.
C-c @mark subtree

Other

Narrowing

normalboonaction
C-x n sorg-narrow-to-subtree

Tags

normalboonaction
C-c C-cset tags for heading
C-c C-qset tags for current heading
C-u C-c C-qrealign tags in all headings

Links

normalboonaction
C-c C-oopen link at point
C-u C-c C-ladd link to a file

Capturing / Refiling

normalboonaction
C-c cRun Org-capture
C-c C-wRun Org-refile

Export

normalboonaction
C-c C-erun org-mode export dialog

Timer

normalboonaction
C-c C-x tset timer
C-c C-x ppause or restart timer
C-c C-x aactivate timer
C-c C-x eend timer