39 lines
894 B
Lua
39 lines
894 B
Lua
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
|
|
local choice = ls.choice_node
|
|
local dynamicn = ls.dynamic_node
|
|
|
|
local date = function()
|
|
return { os.date '%Y-%m-%d' }
|
|
end
|
|
|
|
ls.add_snippets(nil, {
|
|
markdown = {
|
|
snip({
|
|
trig = 'blogpost',
|
|
namr = 'Zola blogpost Frontmatter',
|
|
dscr = 'Frontmatter metadata for Zola markdown blogpost',
|
|
}, {
|
|
text { '+++', "title = '" },
|
|
insert(1, 'note_title'),
|
|
text { "'" },
|
|
text { '', 'date = "' },
|
|
func(date, {}),
|
|
text { '"' },
|
|
text { '', 'updated = ' },
|
|
func(date, {}),
|
|
text { '', '[taxonomies]' },
|
|
text { '', "tags = ['" },
|
|
insert(2, ''),
|
|
text { "']" },
|
|
text { '', '+++', '', '' },
|
|
insert(0),
|
|
}),
|
|
},
|
|
})
|