commit c7e0cfb3a330bd5ceaf1c09ba27a8b66138e069b
parent e24f9e05e6903a73c2aa7e1e66b4ef4c67225760
Author: Chris Bracken <chris@bracken.jp>
Date: Fri, 5 Jun 2026 14:54:40 +0900
nvim: update :Daily mapping
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua
@@ -103,9 +103,14 @@ end)
-- Open today's daily note unconditionally.
vim.keymap.set('n', '<leader>dn', function()
- local notes_dir = vim.g.notes_dir or "~/Developer/Notes"
- local today = os.date("%Y-%m-%d")
- local path = vim.fn.expand(notes_dir .. "/" .. today .. ".md")
- vim.cmd("edit " .. vim.fn.fnameescape(path))
+ if vim.fn.exists(':Daily') == 2 then
+ vim.cmd('Daily')
+ else
+ local notes_dir = vim.g.notes_dir
+ assert(notes_dir, "vim.g.notes_dir is not set")
+ local today = os.date("%Y/%m/%Y-%m-%d")
+ local path = vim.fn.expand(notes_dir .. "/" .. today .. ".md")
+ vim.cmd("edit " .. vim.fn.fnameescape(path))
+ end
end, { desc = "Open today's daily note", noremap = true, silent = true })