Link: org-mode

Org-mode

Vim shortcut

delete a wordd
delete til end of lined$
delete a word and surrounding spacedaw

View mode

Writeroom/zen mode

SPC t z

Cheatsheet

https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf

Configuration

Configuration basics

Start init.el

C-x C-f Find files in current directory

Place cursor inside parentheses of setq in configure file and press C-M-x to refresh the configuration

Describe variables

Display the documentation of where the cursor is.

describe-variableC-h v
describe-functionC-h f
describe-symbolC-h o

Add, edit, remove content

Edit

(progn ; custom shortcuts
  (global-set-key (kbd "M-s") 'save-buffer)
  (global-set-key (kbd "M-w") 'kill-buffer)
  (global-set-key (kbd "M-f") 'isearch-forward)
  (global-set-key (kbd "M-c") 'kill-ring-save)
  (global-set-key (kbd "M-v") 'yank)
  (global-set-key (kbd "M-z") 'undo)
  )
Copy, PasteM-c, M-v
Save bufferM-s
UndoM-z
Kill bufferM-w
Make Comment line

C-x C-;

Insert emphasis

e.g. =+_*~ C-c C-x C-f

Insert parentheses: select the region and press M-(

Insert code block

type <s and press TAB https://youtu.be/GK3fij-D1G8?si=ZqGSa3k2gcxQq77w

Table
Add separation lineC-c -

Select

Mark the selectC-space

Internal linking

Edit linksC-c C-l
Open linksC-c C-o
Return to previous locationC-c &
store linkC-c C-k (org-store-link)
insert linkC-c C-l (*=**org-insert-link**=)*
Edit linkC-c C-l
Doom

Checklist

Use - [ ] to enter checklist

Use C-c C-c to check this off

Use SPC m x to toggle all selected checkbox

Properties

org-toggle-ordered-propertyC-c C-x o
org-delete-propertyPut cursor in the “PROPERTIES” then C-c C-c d
org-set-propertyC-c C-x p

Task management

Repeating tasks

Repeat on the same day every week

<2023-01-01 Sat +1w>

Repeat on the same day every week, and ensure the next available is always in the future

<2023-01-01 Sat ++1w>

4 weeks after this task has been mark as done

<2023-01-01 Sat .+4w>

Delete

https://www.emacswiki.org/emacs/EmacsNewbieKeyReference#h5o-8

  • Delete character backward: ‘DEL’
  • Delete character forward: ‘C-d’
  • Delete word backward: ‘M-DEL’
  • Delete word forward: ‘M-D’
  • Delete to end of line: ‘C-k’
  • Delete entire line: ‘C-S-DEL’
  • Delete to end of sentence: ‘M-k’
Delete the whole lineC-k
Delete the subtreeC-c C-x C-w
Paste it somewhere elseC-c C-x C-y
Switch to previous/next bufferC-x left/right
Windmove the cursor to next windowC-c left/right/up/bottom
SearchM-f
Search (previous)C-r
Search (next)C-s
Replace

Use swiper to search and replace M-f to search, after getting the search result, use M-q to replace, after entering the replaced words, press RET and: type SPC or y to replace one, delete or n to skip to next ! to replace all

Archive

Archive the itemC-c C-x C-a
Archive subtreeC-u C-c C-x C-s

Effort

C-c C-x e

Priorities

Set priorityenter  [#B] inline, or C-c ,
Increase/dec priority in Agenda view+ or -

TODO keywords and indent

Customized todo keywords at the beginning. Use  |  to separate the TODO/DONE

#+SEQ_TODO: NEXT(n) TODO(t) MAYBE(m) WAITING(w) | DONE(d) CANCELLED(c)
StopC-g
Expand/collapse current headingTab
Expand/collapse heading globallyShift - tab
Indent/unindent an itemM - left/right arrow
Move up or downM - up/down arrow
Move/refile to other treeCtrl - c, Ctrl - w
Change to TODO/DONEShift - left/right
Refresh setup (e.g. keywords)C-c, C-c
A list of TODO keywordsC-c, C-t
Indent returnCtrl - return
SaveC-x, C-s
Find non-task/non-TODO keywords using org-ql

org-ql-sparse-tree

(and (not (todo)) (not (done)))

Org-agenda

Agenda view

Keybinding for agenda view has to be setted on the init file.

(progn ; custom shortcuts
  (global-set-key (kbd "C-c l") #'org-store-link)
  (global-set-key (kbd "C-c a") #'org-agenda)
  (global-set-key (kbd "C-c c") #'org-capture)
  (global-set-key (kbd "C-c b") #'org-iswitchb)
  )

Another one, for the agenda view to process your current file add it witc C-c [

ScheduleC-c, C-s
DeadlineC-c, C-d
Add current files to agenda listC-c [
Get agenda viewM-x org-agenda
Follow mode in agenda viewS-f
Move forward/backwarf / b
Go to agenda day viewv d
Go to agenda weekly viewv w
Go to current day/week/….
Refresh the agenda view (buffer)r
Select day in Calendar viewRET:today, +1:next day
Remove scheduled dateC-u C-c C-s
Go to the another windowTab
Show archived itemsv A

Advanced Agenda

Search TODO keywords in Agenda

M-x org-agenda RET t

then follow the menu to search TODO keywords to filter the todo list

Time stampC-c .
Inactive time stamp (text)C-c !
Time durationUse — to connect two dates
TODO list in Agenda viewC-c a t
Change TODO keywordst

Timer and clocking

Timer

Start counter down timerC-c C-x ;
Timer from 00:00C-c C-x 0
Insert time stampC-c C-x .
Description time stampC-c C-x -
StopC-u C-c C-x ,
PauseC-c C-x ,

Clocking

Clock inC-c C-x C-i
Clock outC-c C-x C-o
CancelC-c C-x C-q
Restart the latestC-c C-x C-x
Jump to the clocked taskC-c C-x C-j
Restart with another taskC-u C-c C-x C-x
Display summaryC-c C-x C-d

Column view C-c C- x C-c

Quit column view: q

Window/buffer management

Switch to previous/next bufferC-x left/right
Windmove the cursor to next windowC-c left/right/up/bottom
Close current windowC-x 0
Close other windowC-x 1
Zoom inC-x C +
Zoom outC-x C -

Use C-u C-c C-c to Recompute the entire table in order to refresh the org-tags-column setting and alignment

Open new window vertically

C-w v

Subtree navigation

Restore startup visibilityC-u C-u TAB
Show TODO treeC-c / t
Go to next subtree at the same levelC-c C-f/b
Go back to previous levelC-c C-u
Go toC-c C-j
Narrow to subtreeC-x n s
Restore the subtree viewC-x n w
org-update-statistics-cookies (update the calculations of [%]C-c #
Show previous and next level around the point (org-reveal)C-c C-r
+org/toggle foldz a
+org/show-next-fold-levelz r

SPC in Doom emacs

Long press SPC to substitude C-, e.g. SPC-u SPC-u TAB to execute C-u C-u TAB

Motion

Move to end of buffer

M->, M-<

Go to line number

M-g g

Go to beginning/end of line

C-a / C-e

C-n next line C-p previous line

Pgdn next page Pgup last page

Bookmark

Create a bookmark

C-x r m

Go to a bookmark

C-x r b

List all bookmark

C-x r l

Evip sniper

sniper modef
sniper but look backF
Jump to next word;
Jum to previous word,
2 char sniper modes
sniper but jump to word in frontt
Select to the end of sentencev f .

Use babel

Press enter in normal mode to execute code

Completion

Completion-at-point (evil)M-TAB

Find and replace

Replace in a file

Use M-x query replace or M-%

Replace in multiple files:

  1. Use dired or SPC o - to enter dired mode
  2. Use m to mark selected file, or t to toggle reverse mark (aka mark all if not select anything yet) Check https://www.gnu.org/software/emacs/manual/html_node/emacs/Marks-vs-Flags.html to see more about Marks and Flags
  3. Use Q or M-x dired-do-find-regexp-and-replace to replace strings. Use C-q C-j if need to enter a line break.

Mark

ddelete
xexecute marks
uunmark
mmark

Dired

SPC o -Dired mode

Switch mode

Switch between emacs and evil mode C-z

Eval

Eval function at pointSPC m e d
Eval expressionM-: