diff --git a/lua/custom/snippets/go.lua b/lua/custom/snippets/go.lua new file mode 100644 index 0000000..02141d0 --- /dev/null +++ b/lua/custom/snippets/go.lua @@ -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), + }), +}) diff --git a/lua/custom/snippets/markdown.lua b/lua/custom/snippets/markdown.lua index 696941c..4b94be6 100644 --- a/lua/custom/snippets/markdown.lua +++ b/lua/custom/snippets/markdown.lua @@ -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), } ) @@ -50,13 +50,13 @@ ls.add_snippets( s({ trig = "iq", dscr = "Insert question" }, fmt( [[ -┏━━━━━━━━━━━━━━ Question 0 ━━━━━━━━━━━━━━━ +┏━━━━━━━━━━━━━━ Question 0 ━━━━━━━━━━━━━━━ **Question** {} **Answer**: -┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ]], { i(0), @@ -66,13 +66,13 @@ ls.add_snippets( s({ trig = "ip", dscr = "Insert problem" }, fmt( [[ -┏━━━━━━━━━━━━━━ Problem 0 ━━━━━━━━━━━━━━━ +┏━━━━━━━━━━━━━━ Problem 0 ━━━━━━━━━━━━━━━ **Problem**: {} **Solution**: -┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ]], { i(0), @@ -83,10 +83,10 @@ ls.add_snippets( s({ trig = "isn", dscr = "Insert side notes" }, fmt( [[ -┏━━━━━━━━━━━━━ Sticky notes ━━━━━━━━━━━━━━ +┏━━━━━━━━━━━━━ Sticky notes ━━━━━━━━━━━━━━ **Theme**: {} {} -┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ]], { i(1),