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

@ -23,6 +23,15 @@ M.subs = {
require("heph.node").open(args[1])
end
end,
doc = function(args)
local title = table.concat(args, " ")
if #title == 0 then
require("heph.util").notify("usage: :Heph doc <title>", vim.log.levels.WARN)
return
end
local node = require("heph.rpc").call("node.create", { kind = "doc", title = title, body = "" })
require("heph.node").open(node.id)
end,
search = function(args)
local query = table.concat(args, " ")
if #query == 0 then