Auto sync: 2025-09-02 22:50:48 (1 files changed)

M  lua/custom/journal.lua
This commit is contained in:
Dane Sabo 2025-09-02 22:50:48 -04:00
parent 3299181c70
commit db646e9880

View File

@ -1,5 +1,29 @@
-- === Journal helpers ===
local journal_dir = vim.fn.expand "~/Documents/Dane's Vault/Writing/Journal" local journal_dir = vim.fn.expand "~/Documents/Dane's Vault/Writing/Journal"
-- ---------- utilities ----------
local function ensure_dir(path)
vim.fn.mkdir(path, "p")
end
local function iso_utc()
return os.date "!%Y-%m-%dT%H:%M:%SZ"
end
-- ---------- create file helper ----------
local function write_if_missing(path, lines)
if vim.fn.filereadable(path) == 0 then
local fh = io.open(path, "w")
if not fh then
vim.notify("Failed to create file at " .. path, vim.log.levels.ERROR)
return false
end
fh:write(table.concat(lines, "\n"))
fh:close()
end
return true
end
-- ---------- :JrnlNew ---------- -- ---------- :JrnlNew ----------
-- Creates a new journal entry with JRNL-YYYYMMDD-HHMMSS.md format -- Creates a new journal entry with JRNL-YYYYMMDD-HHMMSS.md format
local function new_journal_note() local function new_journal_note()