2023-04-14 19:03:31 -04:00
|
|
|
local ls = require("luasnip")
|
|
|
|
|
-- some shorthands...
|
|
|
|
|
local snip = ls.snippet
|
|
|
|
|
local node = ls.snippet_node
|
|
|
|
|
local text = ls.text_node
|
|
|
|
|
local insert = ls.insert_node
|
|
|
|
|
local func = ls.function_node
|
2023-04-18 22:39:23 -04:00
|
|
|
local fmt = require("luasnip.extras.fmt").fmt
|
2023-04-18 22:58:04 -04:00
|
|
|
local fmta = require("luasnip.extras.fmt").fmta
|
2023-04-14 19:03:31 -04:00
|
|
|
|
|
|
|
|
ls.add_snippets(nil, {
|
|
|
|
|
markdown = {
|
|
|
|
|
snip(
|
|
|
|
|
{
|
|
|
|
|
trig = "link",
|
|
|
|
|
namr = "markdown_link",
|
2023-04-14 19:38:59 -04:00
|
|
|
dscr = "Create markdown link [txt](url)",
|
2023-04-14 19:03:31 -04:00
|
|
|
},
|
2023-04-14 19:38:59 -04:00
|
|
|
fmt("[{txt}]({url})", {
|
|
|
|
|
txt = insert(1),
|
|
|
|
|
url = func(function(_, snip)
|
|
|
|
|
return snip.env.TM_SELECTED_TEXT[1] or {}
|
|
|
|
|
end, {}),
|
|
|
|
|
})
|
2023-04-14 19:03:31 -04:00
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2023-04-18 22:58:04 -04:00
|
|
|
ls.add_snippets(nil, {
|
|
|
|
|
markdown = {
|
|
|
|
|
snip(
|
|
|
|
|
{
|
|
|
|
|
trig = "fig",
|
|
|
|
|
namr = "zola_figure",
|
|
|
|
|
dscr = "Zola figure shortcode",
|
|
|
|
|
},
|
|
|
|
|
fmta("{{ figure(src=\"<src>\",\nthumb=\"_small\",\ncaption=\"<caption>\") }}", {
|
|
|
|
|
src = insert(1),
|
|
|
|
|
caption = insert(2),
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2023-04-14 19:03:31 -04:00
|
|
|
-- snippet gal "Hugo Gallery"
|
|
|
|
|
-- {{< gallery hover-effect="none" caption-effect="none" >}}
|
|
|
|
|
--
|
|
|
|
|
-- {{< figure link="img/$1.jpg" thumb="_small"
|
|
|
|
|
-- caption="$2"
|
|
|
|
|
-- caption-position="bottom">}}
|
|
|
|
|
--
|
|
|
|
|
-- $3
|
|
|
|
|
-- {{< /gallery >}}
|
|
|
|
|
-- $0
|
|
|
|
|
-- endsnippet
|
|
|
|
|
--
|
|
|
|
|
-- snippet kbd "Keyboard"
|
|
|
|
|
-- {{<kbd ${1:<key>}>}}$0
|
|
|
|
|
-- endsnippet
|