summaryrefslogtreecommitdiffstats
path: root/lua/snippet
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lua/snippets/c.lua57
1 files changed, 36 insertions, 21 deletions
diff --git a/lua/snippets/c.lua b/lua/snippets/c.lua
index 73b0915..f8e4208 100644
--- a/lua/snippets/c.lua
+++ b/lua/snippets/c.lua
@@ -19,28 +19,43 @@ return {
}),
-- function snippet
- s("fn", {
- c(1, {
- t("void"),
- t("char"),
- t("int"),
- t("short"),
- t("long"),
- t("double"),
- t("float"),
- i(nil, "myType"),
- }),
- t({ "", "" }),
- c(2, {
- t(""),
- t("*")
- }),
- i(3, "myFunc");
- t("("),
- i(4),
- t(")"),
+ 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, {
+ t(""),
+ t("static "),
+ }),
+ c(2, {
+ t("void"),
+ t("char"),
+ t("int"),
+ t("short"),
+ t("long"),
+ t("double"),
+ t("float"),
+ i(nil, "myType"),
+ }),
+ t({ "", "" }),
+ c(3, {
+ t(""),
+ t("*")
+ }),
+ i(4, "myFunc");
+ t("("),
+ i(5),
+ t(")"),
+ })
+ end
+ end, {}),
t({ "", "{", "\t" }),
i(0),
- t({ "", "}" }),
+ t({ "", "}" })
+ }),
})
}