mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
65 lines
1.4 KiB
Lua
65 lines
1.4 KiB
Lua
local luasnip = require("luasnip")
|
|
local s = luasnip.snippet
|
|
local t = luasnip.text_node
|
|
local cr = function() return t { "", "" } end
|
|
local i = luasnip.insert_node
|
|
local f = luasnip.function_node
|
|
|
|
local function datetime() return os.date("%Y-%m-%d %H:%M:%S") end
|
|
local function date() return os.date("%Y-%m-%d") end
|
|
local function quoted(s) return '"' .. s .. '"' end
|
|
|
|
luasnip.add_snippets("typst", {
|
|
s("entry", {
|
|
t("#entry("),
|
|
f(function() return quoted(datetime()) end),
|
|
t { ")[", "" },
|
|
t(" "),
|
|
i(0),
|
|
t { "", "]" },
|
|
}),
|
|
s("from-the-future", {
|
|
t("#entries.from-the-future("),
|
|
f(function() return quoted(date()) end),
|
|
t { ")[", "" },
|
|
t(" "),
|
|
i(0),
|
|
t { "", "]" },
|
|
}),
|
|
s("lang", {
|
|
t('#set text(lang: "'),
|
|
i(0),
|
|
t('")'),
|
|
cr(),
|
|
}),
|
|
})
|
|
|
|
luasnip.add_snippets("go", {
|
|
s("ie", {
|
|
t("if err != nil {"),
|
|
cr(),
|
|
t("\t"),
|
|
i(0),
|
|
cr(),
|
|
t("}"),
|
|
}),
|
|
})
|
|
|
|
luasnip.add_snippets("ruler", {
|
|
s("begin", {
|
|
f(datetime),
|
|
t(" ... "),
|
|
i(0),
|
|
}),
|
|
s("end", {
|
|
f(datetime),
|
|
i(0),
|
|
}),
|
|
})
|
|
|
|
luasnip.add_snippets("nix", {
|
|
s("system", { t("stdenv.hostPlatform.system") }),
|
|
})
|
|
|
|
local haskell_snippets = require("haskell-snippets").all
|
|
luasnip.add_snippets("haskell", haskell_snippets, { key = "haskell" })
|