Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions nvim/lua/plugins/zk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading