combine function and main snippet into one (c)

This commit is contained in:
2024-11-28 22:30:02 -05:00
parent c4a86fb727
commit 3bf7dd1be4

View File

@ -19,8 +19,19 @@ return {
}), }),
-- function snippet -- function snippet
s("fn", { s({ trig = [[fn\|main]], trigEngine = "vim" }, {
d(1, function(_, snip)
if snip.trigger == "main" then
return sn(nil, {
t({ "int", "main(int argc, char *argv[])" })
})
else
return sn(nil, {
c(1, { c(1, {
t(""),
t("static "),
}),
c(2, {
t("void"), t("void"),
t("char"), t("char"),
t("int"), t("int"),
@ -31,16 +42,20 @@ return {
i(nil, "myType"), i(nil, "myType"),
}), }),
t({ "", "" }), t({ "", "" }),
c(2, { c(3, {
t(""), t(""),
t("*") t("*")
}), }),
i(3, "myFunc"); i(4, "myFunc");
t("("), t("("),
i(4), i(5),
t(")"), t(")"),
})
end
end, {}),
t({ "", "{", "\t" }), t({ "", "{", "\t" }),
i(0), i(0),
t({ "", "}" }), t({ "", "}" })
}),
}) })
} }