nvim/luasnip: from-the-future snippet

This commit is contained in:
Primrose 2025-08-31 09:07:26 +08:00
parent 9a63c53260
commit 4eee316429
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -5,11 +5,20 @@ local cr = function() return t { "", "" } end
local i = luasnip.insert_node local i = luasnip.insert_node
local f = luasnip.function_node local f = luasnip.function_node
local function show_date_typst_entry() return os.date('"%Y-%m-%d %H:%M:%S"') end local function datetime() return os.date('"%Y-%m-%d %H:%M:%S"') end
local function date() return os.date('"%Y-%m-%d"') end
luasnip.add_snippets("typst", { luasnip.add_snippets("typst", {
s("entry", { s("entry", {
t("#entry("), t("#entry("),
f(show_date_typst_entry), f(datetime),
t { ")[", "" },
t(" "),
i(0),
t { "", "]" },
}),
s("from-the-future", {
t("#entries.from-the-future("),
f(date),
t { ")[", "" }, t { ")[", "" },
t(" "), t(" "),
i(0), i(0),