Link: org-mode
Org-mode
Vim shortcut
| delete a word | d |
|---|---|
| delete til end of line | d$ |
| delete a word and surrounding space | daw |
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-variable | C-h v |
|---|---|
| describe-function | C-h f |
| describe-symbol | C-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, Paste | M-c, M-v |
|---|---|
| Save buffer | M-s |
| Undo | M-z |
| Kill buffer | M-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 line | C-c - |
|---|---|
Select
| Mark the select | C-space |
Internal linking
| Edit links | C-c C-l |
|---|---|
| Open links | C-c C-o |
| Return to previous location | C-c & |
| store link | C-c C-k (org-store-link) |
| insert link | C-c C-l (*=**org-insert-link**=)* |
| Edit link | C-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-property | C-c C-x o |
|---|---|
| org-delete-property | Put cursor in the “PROPERTIES” then C-c C-c d |
| org-set-property | C-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 line | C-k |
|---|---|
| Delete the subtree | C-c C-x C-w |
| Paste it somewhere else | C-c C-x C-y |
Search
| Switch to previous/next buffer | C-x left/right |
|---|---|
| Windmove the cursor to next window | C-c left/right/up/bottom |
| Search | M-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 item | C-c C-x C-a |
|---|---|
| Archive subtree | C-u C-c C-x C-s |
Effort
C-c C-x e
Priorities
| Set priority | enter [#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)| Stop | C-g |
|---|---|
| Expand/collapse current heading | Tab |
| Expand/collapse heading globally | Shift - tab |
| Indent/unindent an item | M - left/right arrow |
| Move up or down | M - up/down arrow |
| Move/refile to other tree | Ctrl - c, Ctrl - w |
| Change to TODO/DONE | Shift - left/right |
| Refresh setup (e.g. keywords) | C-c, C-c |
| A list of TODO keywords | C-c, C-t |
| Indent return | Ctrl - return |
| Save | C-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 [
| Schedule | C-c, C-s |
|---|---|
| Deadline | C-c, C-d |
| Add current files to agenda list | C-c [ |
| Get agenda view | M-x org-agenda |
| Follow mode in agenda view | S-f |
| Move forward/backwar | f / b |
| Go to agenda day view | v d |
| Go to agenda weekly view | v w |
| Go to current day/week/… | . |
| Refresh the agenda view (buffer) | r |
| Select day in Calendar view | RET:today, +1:next day |
| Remove scheduled date | C-u C-c C-s |
| Go to the another window | Tab |
| Show archived items | v 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 stamp | C-c . |
|---|---|
| Inactive time stamp (text) | C-c ! |
| Time duration | Use — to connect two dates |
| TODO list in Agenda view | C-c a t |
| Change TODO keywords | t |
Timer and clocking
Timer
| Start counter down timer | C-c C-x ; |
|---|---|
| Timer from 00:00 | C-c C-x 0 |
| Insert time stamp | C-c C-x . |
| Description time stamp | C-c C-x - |
| Stop | C-u C-c C-x , |
| Pause | C-c C-x , |
Clocking
| Clock in | C-c C-x C-i |
|---|---|
| Clock out | C-c C-x C-o |
| Cancel | C-c C-x C-q |
| Restart the latest | C-c C-x C-x |
| Jump to the clocked task | C-c C-x C-j |
| Restart with another task | C-u C-c C-x C-x |
| Display summary | C-c C-x C-d |
Column view C-c C- x C-c
Quit column view: q
Navigation
Window/buffer management
| Switch to previous/next buffer | C-x left/right |
|---|---|
| Windmove the cursor to next window | C-c left/right/up/bottom |
| Close current window | C-x 0 |
| Close other window | C-x 1 |
| Zoom in | C-x C + |
| Zoom out | C-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 visibility | C-u C-u TAB |
|---|---|
| Show TODO tree | C-c / t |
| Go to next subtree at the same level | C-c C-f/b |
| Go back to previous level | C-c C-u |
| Go to | C-c C-j |
| Narrow to subtree | C-x n s |
| Restore the subtree view | C-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 fold | z a |
| +org/show-next-fold-level | z 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
Navigate to previous/next line
C-n next line C-p previous line
Navigate to next page
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 mode | f |
|---|---|
| sniper but look back | F |
| Jump to next word | ; |
| Jum to previous word | , |
| 2 char sniper mode | s |
| sniper but jump to word in front | t |
| Select to the end of sentence | v 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:
- Use
diredorSPC o -to enter dired mode - Use
mto mark selected file, ortto 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 - Use
QorM-x dired-do-find-regexp-and-replaceto replace strings. Use C-q C-j if need to enter a line break.
Mark
| d | delete |
|---|---|
| x | execute marks |
| u | unmark |
| m | mark |
Dired
SPC o - | Dired mode |
Switch mode
Switch between emacs and evil mode C-z
Eval
| Eval function at point | SPC m e d |
|---|---|
| Eval expression | M-: |