Init commit

This commit is contained in:
Archie Fox
2025-07-25 13:09:33 +03:00
commit 7f1d7f48dd
30 changed files with 1469 additions and 0 deletions

103
lua/snippets/go.lua Normal file
View File

@@ -0,0 +1,103 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local c = ls.choice_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep
return {
-- func
s(
"fn",
fmt("func {}() {{\n\t{}\n}}", {
i(1, "functionName"),
i(2, "// body"),
})
),
-- main
s(
"main",
fmt(
[[
func main() {{
{}
}}
]],
{
i(1, "// your code here"),
}
)
),
-- if err != nil
s(
"ifr",
fmt(
[[
if err != nil {{
return {}
}}
]],
{
i(1, "err"),
}
)
),
-- for loop
s(
"for",
fmt(
[[
for {} := 0; {} < {}; {}++ {{
{}
}}
]],
{
i(1, "i"),
rep(1),
i(2, "n"),
rep(1),
i(3, "// body"),
}
)
),
-- struct
s(
"struct",
fmt(
[[
type {} struct {{
{}
}}
]],
{
i(1, "MyStruct"),
i(2, "Field string"),
}
)
),
-- method
s(
"meth",
fmt(
[[
func ({}) {}({}) {} {{
{}
}}
]],
{
i(1, "m *MyStruct"),
i(2, "MethodName"),
i(3, ""),
i(4, ""),
i(5, "// body"),
}
)
),
}