heph.nvim: follow-or-create wiki links + :Heph doc
Some checks failed
Build / validate (pull_request) Failing after 4m13s

Pressing <CR> on a [[wiki-link]] whose target doesn't exist now creates a doc
with that title and opens it (the zettelkasten gesture), and materializes the
source's backlink: if the source has unsaved edits, saving re-extracts and
links it (and persists the edits); otherwise the wiki link is added directly
(a no-op re-save wouldn't re-extract). Adds :Heph doc <title> to create a
standalone wiki entry. e2e covers both the saved-source and just-typed-source
paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-06-02 11:07:09 -07:00
commit 9249ca46a1
5 changed files with 80 additions and 11 deletions

View file

@ -50,14 +50,18 @@ Beyond the existing methods (tech-spec §6), the plugin relies on
**`node.resolve {title} → Node | null`**: an exact, owner-scoped,
non-tombstoned alias-then-title match — the same mapping the store uses to
materialize `wiki` links, so "follow link under cursor" jumps to the *same*
node the stored link points at.
node the stored link points at. When the target doesn't resolve, follow
**creates** a `doc` with that title (the zettelkasten follow-or-create gesture)
and materializes the source's backlink (saving the source if it has unsaved
edits, else adding the `wiki` link directly).
## Commands (as of slice 11c)
| Command | Action |
|---|---|
| `:Heph today` / `:Heph journal <YYYY-MM-DD>` | Open today's / a dated journal |
| `:Heph follow` (also `<CR>` in a node buffer) | Follow the `[[link]]` under the cursor |
| `:Heph follow` (also `<CR>` in a node buffer) | Follow the `[[link]]` under the cursor — **creating** the target doc if it doesn't exist yet |
| `:Heph doc <title>` | Create (and open) a new wiki doc |
| `:Heph open <id>` | Open a node buffer by id |
| `:Heph search <query>` | Full-text search; pick a result to open |
| `:Heph next [scope]` | Tactical "what is next?" view (`<CR>` opens a task's context) |