Snippets: Markdown, Go
- Go: Add section snippet - Markdown: Update golang codeblock
This commit is contained in:
parent
4c89fa6339
commit
e0b6f4ba88
2 changed files with 31 additions and 7 deletions
24
lua/custom/snippets/go.lua
Normal file
24
lua/custom/snippets/go.lua
Normal 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),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
@ -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),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -50,13 +50,13 @@ ls.add_snippets(
|
||||||
s({ trig = "iq", dscr = "Insert question" },
|
s({ trig = "iq", dscr = "Insert question" },
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
┏━━━━━━━━━━━━━━ Question 0 ━━━━━━━━━━━━━━━
|
┏━━━━━━━━━━━━━━ Question 0 ━━━━━━━━━━━━━━━
|
||||||
**Question**
|
**Question**
|
||||||
{}
|
{}
|
||||||
|
|
||||||
**Answer**:
|
**Answer**:
|
||||||
|
|
||||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(0),
|
i(0),
|
||||||
|
|
@ -66,13 +66,13 @@ ls.add_snippets(
|
||||||
s({ trig = "ip", dscr = "Insert problem" },
|
s({ trig = "ip", dscr = "Insert problem" },
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
┏━━━━━━━━━━━━━━ Problem 0 ━━━━━━━━━━━━━━━
|
┏━━━━━━━━━━━━━━ Problem 0 ━━━━━━━━━━━━━━━
|
||||||
**Problem**:
|
**Problem**:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
**Solution**:
|
**Solution**:
|
||||||
|
|
||||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(0),
|
i(0),
|
||||||
|
|
@ -83,10 +83,10 @@ ls.add_snippets(
|
||||||
s({ trig = "isn", dscr = "Insert side notes" },
|
s({ trig = "isn", dscr = "Insert side notes" },
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
┏━━━━━━━━━━━━━ Sticky notes ━━━━━━━━━━━━━━
|
┏━━━━━━━━━━━━━ Sticky notes ━━━━━━━━━━━━━━
|
||||||
**Theme**: {}
|
**Theme**: {}
|
||||||
{}
|
{}
|
||||||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1),
|
i(1),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue