kickstart.nvim/lua/snippets.lua

38 lines
899 B
Lua
Raw Normal View History

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 { '', 'author = Joost Agterhoek' },
text { '', 'date = ' },
func(date, {}),
text { '', 'updated = ' },
func(date, {}),
text { '', '[taxonomies]' },
text { '', "tags = ['" },
insert(2, ''),
text { "']" },
text { '', '---', '', '' },
insert(0),
}),
},
})