--- Configuration defaults, socket resolution, and default keymaps. local M = {} M.defaults = { --- Path to hephd's unix socket. `nil` → `$HEPH_SOCKET`, else the daemon default. --- The plugin is connect-only; run the daemon with `heph daemon start`. socket = nil, --- 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 `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`, else a **stable** --- `/heph/hephd.sock` (matching `hephd::default_socket_path`; not a --- temp dir, since the daemon is a persistent service). `$HEPH_SOCKET` 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 if xdg and #xdg > 0 then return (xdg:gsub("/+$", "")) .. "/heph/hephd.sock" end local data = vim.env.XDG_DATA_HOME if not (data and #data > 0) then data = (vim.env.HOME or "") .. "/.local/share" end return (data:gsub("/+$", "")) .. "/heph/hephd.sock" 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", "hj", function() require("heph.journal").open() end, { desc = "heph: today's journal" }) map("n", "hn", function() require("heph.view").next() end, { desc = "heph: what is next (Tactical)" }) map("n", "hl", function() require("heph.view").list() end, { desc = "heph: task list (Organizational)" }) map("n", "hd", function() require("heph.task").set_state_current("done") end, { desc = "heph: mark current task done" }) map("n", "hp", function() require("heph.task").promote_under_cursor() end, { desc = "heph: promote context item to a task" }) end return M