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 luasnip.add_snippets("typst", { s("entry", { t("#entry("), f(datetime), t { ")[", "" }, t(" "), i(0), t { "", "]" }, }), s("from-the-future", { t("#entries.from-the-future("), f(date), 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("}"), }), }) local haskell_snippets = require("haskell-snippets").all luasnip.add_snippets("haskell", haskell_snippets, { key = "haskell" })