dotfiles/nvim/luasnippets/all.lua

32 lines
586 B
Lua
Raw Normal View History

return {
2023-09-05 22:55:12 +00:00
s(
"today",
f(function()
return os.date("%F")
end)
),
2023-09-05 22:55:12 +00:00
s(
"retrieve",
f(function()
return string.format("(retrieved %s)", os.date("%F"))
end)
),
2023-09-05 22:55:12 +00:00
s(
{ trig = 'reldate (-?%d+) "(.+)"', regTrig = true },
f(function(_, snip)
-- The point is in number of days.
local point = 60 * 60 * 24 * snip.captures[1]
2023-09-05 22:55:12 +00:00
local now = os.time()
return os.date(snip.captures[2], now + point)
end)
),
2023-09-05 22:55:12 +00:00
s("#!", fmt("#!{}", i(1, "/usr/bin/env bash"))),
2023-09-05 22:55:12 +00:00
parse("ie", "(i.e., $1)"),
parse("eg", "(e.g., $1)"),
}