Editable mind maps for Org.
If you’re using Emacs version 29 or later:
(use-package org-mindmap
:vc (:url "https://github.com/krvkir/org-mindmap.git" :rev :newest)
:after org)If you’re using Emacs version prior to 29, clone this repo and use this:
(use-package org-mindmap
:load-path "~/repos/emacs/org-mindmap/"
:after org)The package is usable without extra mappings, but for convenience you might want to add main interactive commands into C-c m prefix space:
(use-package org-mindmap
:vc (:url "https://github.com/krvkir/org-mindmap.git" :rev :newest)
:after org
:bind
(:map org-mode-map
("C-c m c" . org-mindmap-insert-child)
("C-c m s" . org-mindmap-insert-sibling)
("C-c m r" . org-mindmap-insert-root)
("C-c m d" . org-mindmap-delete-node)
("C-c m v" . org-mindmap-switch-layout)
("C-c m m" . org-mindmap-list-to-mindmap)
("C-c m l" . org-mindmap-to-list)))Insert a mindmap block via org-insert-structure-template with C-c C-, m:
#+begin_mindmap #+end_mindmap
Add one root node. Just write it between the mindmap delimiters:
#+begin_mindmap Root node #+end_mindmap
Press C-c C-c to redraw the map. Root node brackets should be added:
⏴ Root node ⏵
Add several child nodes with TAB and siblings with RET:
╭─ First node
⏴ Root node ⏵ ┼─ Second node
╰─ Third node
Edit the text of a node at point with M-RET: this will preserve the layout. Or, if your edits are tiny, just edit the text and redraw the map with C-c C-c.
Move nodes around with M-<up>, M-<down>, M-<left> and M-<right>. Put the cursor on the node text and press one of those keys:
Second node ─┬ ⏴ Root node ⏵ ┬─ First node Fourth node ─╯ ╰─ Third node
Here is the keys reference:
| Command | Hotkey | Description |
|---|---|---|
org-mindmap-edit-node | M-RET | edit node at point[fn:1] |
org-mindmap-insert-sibling | RET | add a node near the current one (as its sibling) |
org-mindmap-insert-child | TAB | add a child node to the current one |
org-mindmap-move-down | M-<down> | move node one sibling down |
org-mindmap-move-up | M-<up> | move node one sibling up |
org-mindmap-promote | M-<left> or M-<right> [fn:2] | move node one level up, i.e. make it its parent’s sibling |
org-mindmap-demote | M-<left> or M-<right> [fn:2] | move node one level down, i.e. make it its sibling’s child |
org-mindmap-delete-node | insert a new map | |
org-mindmap-switch-layout | cycle between left, compact, and centered layouts | |
org-mindmap-align | re-align the mindmap | |
org-mindmap-list-to-mindmap | converts an Org list at point into a mind map | |
org-mindmap-to-list | converts a mind map at point to an Org list |
There are no specialized key maps for navigation: just use the usual text navigation keys.
[fn:1] If you’re editing a leaf node and there’s no markup ahead of it, or you just need to fix a typo or insert a character or two, you may do that without org-mindmap-edit-node, but when the node length changes significantly and map structure lines shift, the map will likely fail to recover its structure after the edit.
[fn:2] M-<left> calls org-mindmap-promote on the right side of the map and org-mindmap-demote on its left side, so nodes move leftwards every time. M-<right> works the same way.
Lists and mindmaps are mostly isomorphic: any list can be transformed to a corresponding mindmap without loss of data (except that bullet types and enumerated lists are not supported for now), and vice versa.
If you have a list, you can transform it to mindmap with org-mindmap-list-to-mindmap:
- For want of a nail - the shoe was lost, - For want of a shoe - the horse was lost, - For want of a horse - the rider was lost, - For want of a rider - the battle was lost, - For want of a battle - the kingdom was lost, - And all for the want - of horseshoe nail.
╭─ For want of a nail ── the shoe was lost, ├─ For want of a shoe ── the horse was lost, ⏴⏵ ┼─ For want of a horse ── the rider was lost, ├─ For want of a rider ── the battle was lost, ├─ For want of a battle ── the kingdom was lost, ╰─ And all for the want ── of horseshoe nail.
… and back to list with org-mindmap-to-list.
Mindmaps are only left to right. Two-sided mindmaps are not supported. Bidirectional maps are now supported!
No formatting inside nodes text is supported yet.
There are three layouts:
left, the simplest and the default one
#+begin_mindmap :layout left
⏴⏵ ┬─ root ng ┬─ node b ┬─ node d
│ │ ├─ node c
│ │ ╰─ node e ── node f
│ ╰─ node a
╰─ disk c: ┬─ Windows
╰─ Users
#+end_mindmap
compact, the one where nodes float up if there’s space for them (like node a here).
#+begin_mindmap :layout compact
⏴⏵ ┬─ root ng ┬─ node b ┬─ node d
│ ╰─ node a ├─ node c
│ ╰─ node e ── node f
╰─ disk c: ┬─ Windows
╰─ Users
#+end_mindmap
centered, like above, but the root nodes are vertically centered against their children.
#+begin_mindmap :layout centered
╭─ node d
╭─ root ng ┬─ node b ┼─ node c
⏴⏵ ┤ ╰─ node a ╰─ node e ── node f
╰─ disk c: ┬─ Windows
╰─ Users
#+end_mindmap
I’ve tested the package with Hack font, and things seem to work fine.
Some fonts declare double size for symbols which are used as root node markers by default. You may either change your font or change default symbols for the root node (make sure those symbols are not ones used to draw map connectors and will not occur in your map nodes as text).
Here’s one more complex example mindmap for a chapter from Sönke Ahrens — How to Take Smart Notes.
╭─ thinking
├─ studying
╭─ Writing ── is an aid for ┼─ generating ideas
│ ├─ reading
│ ╰─ understanding
├─ Thinking ── happens on paper
├─ Rules ── keep a pen at hand
├─ fleeting ╭─ fleeting :: reminders of thoughts ┬─ put in one place
│ │ ╭─ when reading ╰─ process later
│ │ ├─ briefly
│ ├─ literature ┼─ selectively ── for your own topics
│ │ ├─ in your own words
│ │ ├─ with bibliographic data
│ │ ╰─ put to the reference system
⏴⏵ ┤ │ ╭─ feeting
│ │ ╭─ review notes ┼─ literature
│ │ │ ╰─ once a day ╭─ research
╰─ Process ┬─ collect notes ┤ ├─ think ── how they relate to ┼─ reflections
│ │ ├─ one note for each idea ╰─ interests
│ │ │ ╭─ full sentences
│ │ │ ├─ sources
│ ╰─ permanent ┼─ as for another person ┼─ links
├─ turn into draft ├─ discard ── fleeting ├─ precisely
╰─ edit │ ├─ clearly
│ ╰─ briefly
├─ add ┬─ behind the note it relates to directly
│ ╰─ links
╰─ make sure ── you can find it ┬─ in the index
╰─ at entry point
One more map, from another book: Ervand Abrahamian. A History of Modern Iran.
constant ─╮
3 x France ─┬ size ─┤
6 x UK ─╯ │
Persian Gulf ── south ─┤
Khurasan ─╮ │ ╭─ (property) ── (beg XX) ── (beg XXI)
Sistan ─┼ mountains of ── east ─┤ ├─ population ── 12 mln ── 69 mln
Baluchestan ─╯ │ ├─ .. village ── 60% ── <30%
Shatt al-Arab marshes ─┬ west ─┤ ├─ .. nomads ── 25% ── 3%
Kurdish mountains ─╯ ├ Geography ── ⏴ Iran ⏵ ── Identity ┼─ .. urban ── 15% ── 66%
Aras ─┬ rivers ── north ─┤ ├─ .. of Tehran ── 200k ── 6.5mln
Artak ─╯ │ ├─ life expectancy ── 30y ── 70y
rainfall ── lacks ─┤ ├─ child mortality ── 50% ── 3%
Azerbaijan ─╮ │ ├─ literacy ── 5% ── 85%
Kurdestan ─┤ │ ╰─ .. in Persian ── <50% ── >85%
Caspian coast ─┼ only ── farming ─╯
irrigated villages ─┤
near mountains ── oases ─╯