From 474b772e3a4c849dd266404459b4855a7b649ae2 Mon Sep 17 00:00:00 2001 From: Junhyeok Ahn Date: Sat, 14 Mar 2026 11:23:59 -0400 Subject: [PATCH] zk daily fix --- nvim/lua/plugins/zk.lua | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/nvim/lua/plugins/zk.lua b/nvim/lua/plugins/zk.lua index 54168dc..e5fe8b2 100644 --- a/nvim/lua/plugins/zk.lua +++ b/nvim/lua/plugins/zk.lua @@ -90,29 +90,19 @@ local function new_meeting_note() end local function open_or_create_daily_note() - api.list(notebook_dir, { - select = { "path" }, - hrefs = { "daily" }, - created = "today", - limit = 1, - sort = { "created-" }, - }, function(err, notes) - if err then - notify("Failed to list daily notes: " .. tostring(err), vim.log.levels.ERROR) - return - end + local today = os.date("%Y-%m-%d") + local daily_path = notebook_dir .. "/daily/" .. today .. ".md" - if notes and not vim.tbl_isempty(notes) then - edit_abs_path(notebook_dir .. "/" .. notes[1].path) - return - end + if vim.fn.filereadable(daily_path) == 1 then + edit_abs_path(daily_path) + return + end - zk.new({ - group = "daily", - dir = "daily", - date = "today", - }) - end) + zk.new({ + group = "daily", + dir = "daily", + date = "today", + }) end local map = vim.keymap.set