summaryrefslogtreecommitdiffstats
path: root/lua/snippets/c.lua
blob: 73b0915cb4ebb36125c8747e4ab1e6e4e7e228cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require('core.snippets.shorthands')

return {
  -- method snippet
  s("main", {
    c(1, {
      t(""),
      t("static "),
    }),
    t("int main("),
    c(2, {
      t("int argc, char *argv[]"),
      i(1, "void"),
    }),
    t(")"),
    t({ " {", "\t" }),
    i(0),
    t({ "", "}" }),
  }),

  -- 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(")"),
    t({ "", "{", "\t" }),
    i(0),
    t({ "", "}" }),
  })
}