Read config.toml, keys.toml and themes, and open them with :config (stage 8b)

The config folder now sets everything: config.toml the settings (now
also `theme` and `editor`), keys.toml the keys, and themes/<name>.toml
the theme, laid over the built-in one, so a theme only needs what it
changes. Each file is applied again a second after it's saved; a
mistake only drops its own line, and the status bar says what's wrong,
naming the file.

:config lists the three files with their folder; Enter hands the
terminal to your editor (the editor setting, $VISUAL, $EDITOR, else
notepad or vi), writing the file first if it's missing, with every
option at its default behind a #, explained (keys.toml lists every
command by name). :theme switches themes until cumulus quits, like
:set.

The built-in theme gets the named styles the user picked, each also put
on by its tag: question (yellow, dashed), important (red, thick) and done
(gray, its title faded); and link styles blocks and supports, whose
label shows on a link without its own. Themes can also set [modes],
[node], [root], [branch] and [link].

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
skkeyeandClaude Opus 5.5 committed 2026-10-01 23:55:11 -04:00
1 parent f6dc4564aa
commit abe3dc1d84
26 files changed
+1683 -129

No files matched your search

+56 -21
View File
@@ -437,12 +437,31 @@ document has a portal pointing here.
```
**Config** (TOML) lives in `%APPDATA%\cumulus\config` (`~/.config/cumulus` on
Linux); `cumulus --paths` prints the folders. `:config` writes these files with
a comment on every option, and cumulus reloads them when they change.
Linux); `cumulus --paths` prints the folders. Each file only states what it
changes: a missing file changes nothing, and a mistake only drops its own line,
with a message in the status bar saying what's wrong. cumulus applies a file
again when it's saved. (Settled in part 8b.)
- `:config` lists config.toml, keys.toml and the theme's file, with the folder
they're in; Enter opens one in your editor (the `editor` setting, `$VISUAL`,
`$EDITOR`, else notepad on Windows and vi elsewhere), with the terminal
handed over until it's done. A file that isn't there yet is written first,
every option at its default behind a `#`, with what it does: keys.toml lists
every command by name.
- `:set` and `:theme` change things until cumulus quits, as in vim; the files
change them for good.
- A theme file is laid over the built-in theme (`default`): a theme that says
just `accent = "magenta"` is the built-in one in magenta, and
`themes/default.toml` changes the built-in theme itself. Screen colors are
terminal colors; the colors in looks and styles are palette names.
- The built-in theme comes with named styles, each put on by the tag of the
same name: `question` (yellow, dashed), `important` (red, thick) and `done`
(gray, its title faded); and two for links, `blocks` (red, dashed, "blocks")
and `supports` (green, "supports"). The user's pick in part 8b.
```toml
# config.toml
theme = "default" # a file in the themes folder
theme = "default" # or a file in the themes folder
default_document = "ideas" # what `cumulus` looks for at startup
autosave = true
mouse = true
@@ -451,11 +470,11 @@ which_key_delay = "300ms"
max_node_width = 30
glyphs = "unicode" # "ascii" for fonts without box-drawing characters
completion_popup = "as-you-type" # "on-tab": only after Tab, like vim's wildmenu
editor = "" # what :config opens files in ("nvim", "code --wait")
# keys.toml: sections motions, normal, canvas, outline, note, visual, move,
# connect, list, card, text (vim keys inside text), insert (typing: one key each,
# the others type themselves); commands by name (src/input/command.rs);
# "nothing" unbinds
# the others type themselves); commands by name; "nothing" unbinds
leader = "<Space>"
[normal]
"<Space>x" = "delete-branch"
@@ -463,23 +482,37 @@ leader = "<Space>"
[canvas]
"H" = "previous-document"
# themes/default.toml
accent = "cyan"
[palette] # terminal names, 0-255, or "#rrggbb"
red = 167
orange = 208
green = 108 # … yellow, teal, blue, purple, pink, brown, gray
# themes/night.toml
accent = "cyan" # screen colors: terminal names, 0-255, or "#rrggbb"
muted = "darkgray"
[modes]
insert = "green"
visual = "magenta"
[styles.node.question]
color = "yellow"
[palette] # the colors nodes and lines are given, by name
red = 167
orange = 208 # … yellow, green, teal, blue, purple, pink, brown, gray
[node] # every node, unless something says otherwise
border = "square"
[root]
border = "rounded"
[branch] # lines from a parent to its children
line = "solid"
arrows = "off"
color = "node" # the parent's own color
[link] # cross-links
line = "dashed"
arrows = "end"
[styles.node.question] # named node styles: <Space>s, and [tags]
color = "yellow" # a palette color
border = "dashed"
[styles.link.blocks]
[styles.node.done]
color = "gray"
faded = true # the title in the muted color
[styles.link.blocks] # named line styles, for links
color = "red"
line = "dashed"
arrows = "end"
label = "blocks"
label = "blocks" # shown on a link without a label of its own
[tags]
question = "question" # a #question node gets the "question" style
```
@@ -523,22 +556,24 @@ cumulus/
│ motion, object, layout), list (the popup list help, menus and pickers
│ share), card (the K card), status_bar, document_bar, which_key,
│ command_line, theme, glyphs
├─ config/ paths (the config and data folders), settings (and `:set`); later keys_file,
│ theme_file (TOML)
├─ config/ paths (the config and data folders), settings (config.toml, `:set`), keys_file
│ (keys.toml's template), theme_file (themes laid over the built-in one)
├─ storage/ document_file (RON), write_atomically, names (file names from titles), backup,
│ lock, stamp (noticing changes made outside), memory (memory.ron)
└─ app/ mod.rs (App), input (keys and the mouse, routed), update (carrying actions out),
render, terminal (the main loop, setup, teardown, panic hook), startup (what
`cumulus` opens), documents (the open documents and their files), files
(saving, reloading, locks, where you left off), action, mode, buffer, commands
(saving, reloading, locks, where you left off), configure (settings, keys and
themes applied; `:config`), action, mode, buffer, commands
(keys every view shares), calls (`:` commands), text_edit (a node's text being
edited, rapid entry), registers, panes (the split tree), popup (help, menu,
pickers, card, questions); later jumps, portals (cache, backlinks, renames)
```
The end-to-end tests are in `app/tests.rs` (and `app/tests/files.rs`): they
copy the sample documents to a temporary folder, type keys and click on a test
terminal, and check the screen, the documents and the files.
The end-to-end tests are in `app/tests.rs` (with `app/tests/files.rs` and
`app/tests/config.rs`): they copy the sample documents to a temporary folder,
type keys and click on a test terminal, and check the screen, the documents
and the files.
**Flow:** a terminal event comes in → the key engine turns keys into a typed
`Command` (with its count and register) → the focused view answers it with