hephaestus/heph.nvim/lua/heph/config.lua
Erich Blume d0930aa6a3
All checks were successful
Build / validate (pull_request) Successful in 16m0s
heph.nvim: :Heph journals — recent-days picker with preview + @create
A dailies picker (zkd-style): lists the last `journal_days` (default 7) days
newest-first, previews existing journals and shows "@create" for new ones, and
opens the chosen day (creating if new). Journals resolve by their ISO-date
title, so no new RPC is needed. picker.select gains an optional Telescope
preview pane. e2e covers the recent-days list (exists/@create across a month
boundary) and open-on-pick via a stubbed vim.ui.select.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:26:45 -07:00

71 lines
2.5 KiB
Lua

--- Configuration defaults, socket resolution, and default keymaps.
local M = {}
M.defaults = {
--- Path to hephd's unix socket. `nil` → `$HEPH_SOCKET`, else the daemon default.
socket = nil,
--- DB path for an autostarted local daemon. `nil` → `$HEPH_DB`, else hephd's default.
db = nil,
--- Plug-and-play: spawn (and manage) a local hephd when none is serving
--- `socket`. Set `false` when you run your own daemon (server/client): the
--- plugin then connects only, and warns if nothing is reachable.
autostart = true,
--- hephd binary for autostart (on PATH for an installed heph).
bin = "hephd",
--- Title of the home / index page (`:Heph home`).
home = "Home",
--- How many recent days the `:Heph journals` picker offers.
journal_days = 7,
--- Set the default `<leader>h*` keymaps. `false` to opt out.
keymaps = true,
}
--- Resolve the socket path: explicit opt, then `$HEPH_SOCKET`, then hephd's
--- default (`$XDG_RUNTIME_DIR/heph/hephd.sock`, temp-dir fallback). The env knob
--- lets a dev Neovim target a `mise run dev` daemon without touching real data.
function M.resolve_socket(opt)
opt = (opt and #opt > 0) and opt or vim.env.HEPH_SOCKET
if opt and #opt > 0 then
return opt
end
local xdg = vim.env.XDG_RUNTIME_DIR
local base = (xdg and #xdg > 0) and xdg or (vim.env.TMPDIR or "/tmp")
return (base:gsub("/+$", "")) .. "/heph/hephd.sock"
end
--- Resolve the DB path for an autostarted daemon: explicit opt, then `$HEPH_DB`,
--- else nil (let hephd pick its default). Pairs with `resolve_socket` for dev
--- isolation.
function M.resolve_db(opt)
opt = (opt and #opt > 0) and opt or vim.env.HEPH_DB
if opt and #opt > 0 then
return opt
end
return nil
end
--- Apply the default keymaps (no-op when `opts.keymaps` is false).
function M.apply_keymaps(opts)
if not opts.keymaps then
return
end
local map = vim.keymap.set
map("n", "<leader>hj", function()
require("heph.journal").open()
end, { desc = "heph: today's journal" })
map("n", "<leader>hn", function()
require("heph.view").next()
end, { desc = "heph: what is next (Tactical)" })
map("n", "<leader>hl", function()
require("heph.view").list()
end, { desc = "heph: task list (Organizational)" })
map("n", "<leader>hd", function()
require("heph.task").set_state_current("done")
end, { desc = "heph: mark current task done" })
map("n", "<leader>hp", function()
require("heph.task").promote_under_cursor()
end, { desc = "heph: promote context item to a task" })
end
return M