Skip to content
This repository was archived by the owner on Mar 26, 2022. It is now read-only.

Latest commit

 

History

History
298 lines (249 loc) · 11.8 KB

emacs.org

File metadata and controls

298 lines (249 loc) · 11.8 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.

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
C-vnonescroll to next screen
M-vnonescroll to previous screen
C-M-psamescroll-down-line
C-M-nsamescroll-up-line
C-lnonescroll current line to center, top, bottom
M-rsamereposition cursor to center, top, bottom
M-mgo to first non-whitespace on line, forward or backward

Editing

Files

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

C-jperform ENTER followed by TAB
C-oinsert blank line
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

M-uuppercase 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

M-%Search and replace

Frames and Windows

C-x 1delete other windows
C-x 2split window, above and below
C-x 3split window, side by side
C-M-vscroll other window
C-x oswitch cursor to another window
C-x 4 bselect buffer in other window
C-x 4 C-odisplay buffer in other window
C-x 4 ffind file in other window
C-x 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 0kill current buffer and delete window

Other

Transposing

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

Read-only mode

C-x C-qToggle read-only mode

Numeric argument

C-u numrepeat following instruction num times

Abbrevs

C-x a gAdd global abbrev

Spell check

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

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

Killing and deleting

C-wkill region
M-wcopy region to kill buffer
C-yyank back last thing killed
M-yreplace last yank with previous kill, cycle kill ring
M-z charzap to char

Marking

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

Narrowing

C-x n nnarrow to region
C-x n pnarrow to page
C-x n wwiden view

Undo / Redo

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

Registers

C-x r ssave region in register
C-x r iinsert register contents into buffer
C-x r SPACEsave value of point in register
C-x r jjump to point saved in register

Keyboard Macros

F3record keyboard macro
F4end record keyboard macro / run keyboard macro

Bookmarks

C-F5Bookmark set
S-F5List bookmarks
F5Bookmark jump

Counting words

M-=count words in region
C-u M-=count words in whole buffer

Mark-ring

C-<SPC> C-<SPC>set the mark to the mark ring
C-u C-<SPC>move point to where the mark was
<f7>push current position to the mark ring
M-<f7>jump to last position in the mark ring (go back)

Whitespace

M-x whitespace-modetoggles rendering of white space

Winner-mode

C-c left / rightredo/undo window configuration

Writeroom

F9Writeroom mode
S-F9modeline toggle
C->Increase width
C-<Decrease width

Magit

C-x grun Magit
sstage
ccommit
C-c C-cExecute commit, after having written the commit message
Ppush
Fpull
hshow Magit keyboard commands
qexit Magit

Draftmode

M-x draft-modeTurn on draft-mode

Yasnippet

TABexpand snippet
C-c s nnew snippet
C-c s vvisit snippet file

Transparency

C-c ttoggle transparency

wc-mode

C-c wTurn on wc-mode
M-x wccount words in buffer
M-x wc-resetReset wc-mode
C-c C-w wset word goal

Zoom

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

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-sidebar

M-x sbshow sidebar
M-x sbtreeshow tree sidebar
M-x sbttoggle sidebar
M-x sbtreettoggle tree sidebar

Hint: use C-x n w to widen the view of the main org-mode buffer if needed.

Org-tracktable

M-x ttiinsert tracktable
Mx-ttwwrite new tracktable entry
M-x ttsshow 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

C-c drun deft
C-c C-qquit deft

Org-mode

Visibility

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

Navigate

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

Edit

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

M-hmark the element at point. Hitting M-h multiple times will mark next item
C-c @mark subtree

Other

Narrowing

C-x n sorg-narrow-to-subtree

Tags

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

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

Capturing / Refiling

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

Export

C-c C-erun org-mode export dialog

Timer

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