Skip to content

Instantly share code, notes, and snippets.

@bouyagas
Forked from safijari/orgmode_spacemacs.org
Created April 17, 2020 20:54
Show Gist options
  • Save bouyagas/a9013bb1df95ae1eaecde95299e7f459 to your computer and use it in GitHub Desktop.
Save bouyagas/a9013bb1df95ae1eaecde95299e7f459 to your computer and use it in GitHub Desktop.
Org mode spacemacs tutorial file

I hope the tutorial has been useful to you. If it was kindly leave a like and a comment, and consider subscribing and turning on subscription notifications. I intend to make more videos like this on the topics mentioned before as well as on other spacemacs topic like magit (git plugin), large scale refactoring, and a number of other things. Thank you so much for watching.

Org tutorial

Note: a great reference can be had here http://spacemacs.org/layers/+emacs/org/README.html

Outlines/headers

Show that each outline has it’s associated “text” under it

  • Which
  • can
  • have
  • outlines And each outline can have its own associated text.

Headers can be folded and expanded with tab/shift-tab

Tab will toggle one heading, shift-tab will toggle all headings in the file

Elipses will show that a heading/line is folded.

Headers can be nested

and nested
and nested

You can hold alt and “some movement” to change the level. (up and down work too, changing the vertical level in the same horizontal level)

You can search through all headings in a file using (SPC j i)

Links, Images, and other Markup

The org link format is [[link][link text]] e.g. my github

You can also link to images in the same way but without the link text.

Images can have a caption and a name however.

https://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Org-mode-unicorn.svg/162px-Org-mode-unicorn.svg.png

Tables

Org makes it really easy to work with text based tables

Heading 1Heading 2Heading 3
0Name 0City 0
1Name 1City 1

Tasks

Org headlines can also be tasks.

A heading prepended with a “keyword” turns it into a todo

You can cycle through the “keywords” by holding shift and using left or right arrow keys.

You can also just change the text of the keyword itself

This is called “changing the state” and it’s possible to track this

A new task heading at the same level is created with T

You can narrow the view in a file to just the TODOs

Use org-show-todo-tree which you can run with (, T)

Description of a heading/task can have check boxes [1/3] [33%]

  • [X] Subtask 1
  • [ ] Subtask 2 [0/2]
    • [ ] Subtask 2 Subtask 1
    • [ ] Subtask 2 Subtask 2
  • [ ] Subtask 3

Actual sub-headings can be tracked as subtasks as well [0/2]

Todo 1

Todo 2

Agenda

The agenda is a way to track tasks through one or more tracked files. It can also track timed tasks.

You can add the file to be part of the “Agenda”

If you press ctrl-c and then [ then it’ll be added to the agenda. This is the equivalent of setting the following.

'(org-agenda-files (quote ("~/Dropbox/org_tutorial.org")))

**(Also note the nice code block up here, syntax highlighting and all)**

The org-agenda command (SPC a o o) gives a number of options.

Some of the more notable options are…

  1. Task list (t)
  2. Weekly/daily agenda (a)

The weekly/daily agenda doesn’t show anything right now.

Tasks can be given deadlines (, d)

The window to select time is very flexible. You can click a date
  • +1w (in one week from now), can also be day (d), hour (h), month (m), etc
  • 5pm (would go for 5pm today)
  • +2d 11am (at 11am in two days)
  • next Monday at 2pm (exactly as it sounds)
  • etc.

This task will now show up in the day/week agenda for the day/week it’s due in. It will also show up as a hint (“due in N days”, “overdue by N days”)

Tasks can be scheduled to start at a specific time (, s)

This will not show up until that week/day has started

You can do state transitions right in the agenda as well

Some useful modifications

You can change how the bullets look (this can be any unicode character)

(setq org-bullets-bullet-list '("" "" "" "" "" "")

You can have more state transitions to reflect your workflow

(setq org-todo-keywords                                                                                        
    '((sequence "TODO(t!)" "NEXT(n!)" "DOINGNOW(d!)" "BLOCKED(b!)" "TODELEGATE(g!)" "DELEGATED(D!)" "FOLLOWUP(f!)" "TICKLE(T!)" "|" "CANCELLED(c!)" "DONE(F!)")))

This associates shortcuts with the various states, so now you can hit t and get an option to transition

You can modify the colors/appearance of the various keywords as well

(setq org-todo-keyword-faces                                                                                            
        '(("TODO" . org-warning)                                                                                          
          ("DOINGNOW" . "#E35DBF")                                                                                        
          ("CANCELED" . (:foreground "white" :background "#4d4d4d" :weight bold))                                         
          ("DELEGATED" . "pink")                                                                                          
          ("NEXT" . "#008080")))

I also like to have these additional shortcuts for saving/searching

(spacemacs/declare-prefix "o" "own-menu")                                                                               
(spacemacs/set-leader-keys "os" 'org-save-all-org-buffers)                                                              
(spacemacs/set-leader-keys "oi" 'helm-org-agenda-files-headings)                                                        

Exporting

(, e e) opens the menu, you can find some useful themes here https://github.com/fniessen/org-html-themes Code, tables, etc will all be rendered as expected. Github will automatically render org files.

Some advanced topics to look up (might be in future videos)

  • Table formulas (org as excel!)
  • Running code inside org mode (literate programming!)
  • Org Capture
  • Orgzly (Android App)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment