Snippets: Markdown, Go

- Go: Add section snippet
- Markdown: Update golang codeblock
This commit is contained in:
t0xa 2026-10-17 20:36:26 +03:00
parent 4c89fa6339
commit e0b6f4ba88
2 changed files with 31 additions and 7 deletions

View file

@ -0,0 +1,24 @@
-- Clear snippets collection when souring lua file
require("luasnip.session.snippet_collection").clear_snippets "go"
local ls = require "luasnip"
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local util = require "custom.snippets.util"
ls.add_snippets("go", {
s({ trig = "gosection", dscr = "Section header" }, {
t { string.rep("/", 80), "" },
t "//",
f(util.pad_left(80, 2), { 1 }),
i(1, "Section topic"),
f(util.pad_right(80, 2), { 1 }),
t "//",
t { "", string.rep("/", 80), "" },
i(0),
}),
})

View file

@ -42,7 +42,7 @@ ls.add_snippets(
``` ```
]], ]],
{ {
c(1, { t "python", t "bash", t "", t "swift", t "c" }), c(1, { t "python", t "bash", t "go", t "", t "swift", t "c" }),
i(2), i(2),
} }
) )