neovim configuration using rocks.nvim plugin manager

feat: use `birthtime` and `mtime` for `created` and `modified` fields

+23 -3
+23 -3
lua/snippets/norg.lua
··· 10 10 local rep = require("luasnip.extras").rep 11 11 local fmt = require("luasnip.extras.fmt").fmt 12 12 13 + local DATE_FORMAT = "!%Y-%m-%dT%H:%M:%S+09:00" 14 + 13 15 local function today_fn() 14 - return os.date("!%Y-%m-%dT%H:%M:%S+00:00") 16 + return os.date(DATE_FORMAT) 17 + end 18 + 19 + -- TODO: reimplement these with git 20 + local function btime_fn() 21 + local path = vim.fn.expand("%") 22 + local stat = vim.uv.fs_stat(path) 23 + local btime = stat.birthtime or stat.mtime 24 + btime = btime.sec 25 + return os.date(DATE_FORMAT, btime) 26 + end 27 + 28 + local function mtime_fn() 29 + local path = vim.fn.expand("%") 30 + local stat = vim.uv.fs_stat(path) 31 + local mtime = stat.mtime 32 + mtime = mtime.sec 33 + return os.date(DATE_FORMAT, mtime) 15 34 end 16 35 17 36 local function file_index_fn(_, snip) ··· 23 42 else 24 43 title = vim.fn.substitute(snip.env.TM_FILENAME, "\\..*$", "", "g") 25 44 end 45 + title = vim.fn.substitute(title, "-", " ", "g") 26 46 return sn(nil, { i(1, title) }) 27 47 end 28 48 ··· 39 59 ]], 40 60 { 41 61 d(1, file_index_fn), 42 - f(today_fn, {}, { key = "today" }), 43 - rep(k"today"), 62 + f(btime_fn), 63 + f(mtime_fn), 44 64 -- t"", 45 65 -- t"", 46 66 }