Improved flow

This commit is contained in:
Morten Olsen
2026-01-26 23:04:14 +01:00
parent d9950b3e4d
commit b3b70bceeb
28 changed files with 4492 additions and 7 deletions

52
snippets/go.lua Normal file
View File

@@ -0,0 +1,52 @@
-- Go snippets
-- See docs/guides/snippets.md for how to create snippets
--
-- Quick reference:
-- s(trigger, nodes, opts) - Create a snippet
-- t(text) - Text node
-- i(index, default) - Insert node (tab stop)
-- c(index, choices) - Choice node
-- f(func, args) - Function node
-- d(index, func, args) - Dynamic node
-- rep(index) - Repeat node
--
-- Example:
-- s("iferr", fmt("if err != nil {{\n\treturn {}\n}}", { i(1, "err") }))
-- Typing "iferr" + expand will give error handling template
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local c = ls.choice_node
local f = ls.function_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local rep = require("luasnip.extras").rep
local fmt = require("luasnip.extras.fmt").fmt
-- Add your Go snippets here
return {
-- Example: Uncomment and modify as needed
--
-- Error handling
-- s("iferr", fmt([[
-- if err != nil {{
-- return {}
-- }}
-- ]], { i(1, "err") })),
--
-- Function
-- s("fn", fmt([[
-- func {}({}) {} {{
-- {}
-- }}
-- ]], { i(1, "name"), i(2), i(3, "error"), i(0) })),
--
-- Struct
-- s("st", fmt([[
-- type {} struct {{
-- {}
-- }}
-- ]], { i(1, "Name"), i(0) })),
}