File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11-- Keymaps are automatically loaded on the VeryLazy event
22-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
33-- Add any additional keymaps here
4+
5+ -- daily note
6+ vim .keymap .set (" n" , " <leader>td" , function ()
7+ -- Get current date in YYYY-MM-DD format
8+ local date = os.date (" %Y-%m-%d" )
9+ local dir_path = " /Users/khoah/anzx/trackers"
10+ local file_path = dir_path .. " /" .. date .. " .md"
11+
12+ -- Create directory if it doesn't exist
13+ local dir_exists = vim .fn .isdirectory (dir_path )
14+ if dir_exists == 0 then
15+ vim .fn .mkdir (dir_path , " p" )
16+ end
17+
18+ -- Open the file (creates if it doesn't exist)
19+ vim .cmd (" edit " .. file_path )
20+ end , { desc = " Create and open daily tracker file" })
You can’t perform that action at this time.
0 commit comments