2022-02-22 21:49:55 +01:00
|
|
|
local ls = require "luasnip"
|
2021-11-12 01:18:09 +01:00
|
|
|
local s = ls.snippet
|
|
|
|
local t = ls.text_node
|
|
|
|
local i = ls.insert_node
|
2022-03-12 19:42:02 +01:00
|
|
|
local f = ls.function_node
|
2021-11-12 01:18:09 +01:00
|
|
|
|
|
|
|
function date_rfc3339()
|
2022-04-19 11:22:16 +02:00
|
|
|
local cmd = assert(io.popen "/usr/bin/date --rfc-3339=seconds")
|
|
|
|
local output = cmd:read "*all"
|
|
|
|
cmd:close()
|
|
|
|
return output:gsub("\n", "")
|
2021-11-12 01:18:09 +01:00
|
|
|
end
|
|
|
|
|
2022-08-29 19:38:38 +02:00
|
|
|
ls.add_snippets(nil, {
|
2022-04-19 11:22:16 +02:00
|
|
|
markdown = {
|
|
|
|
s({ trig = "zolan", dscr = "Create a new zola entry" }, {
|
|
|
|
t({ "+++", "draft = true" }),
|
|
|
|
t({ "", "date = " }),
|
|
|
|
f(date_rfc3339, {}, {}),
|
|
|
|
t({ "", 'title = "' }),
|
|
|
|
i(1),
|
|
|
|
t '"',
|
|
|
|
t({ "", "[taxonomies]" }),
|
|
|
|
t({ "", 'tags = ["' }),
|
|
|
|
i(2),
|
|
|
|
t '"]',
|
|
|
|
t({ "", "+++", "" }),
|
|
|
|
i(0),
|
|
|
|
}),
|
|
|
|
},
|
2022-08-29 19:38:38 +02:00
|
|
|
})
|
2021-11-12 01:18:09 +01:00
|
|
|
|
2022-02-22 21:49:55 +01:00
|
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|