dotfiles/mzte-nv/conf/lua/pluginconf/p-luasnip.lua

75 lines
1.5 KiB
Lua
Raw Normal View History

2022-10-18 15:32:49 +02:00
local ls = require "luasnip"
2022-11-06 19:05:37 +01:00
--local c = ls.choice_node
--local d = ls.dynamic_node
local i = ls.insert_node
--local r = ls.restore_node
local s = ls.snippet
--local sn = ls.snippet_node
local t = ls.text_node
local fmt = require("luasnip.extras.fmt").fmt
2022-11-11 18:47:09 +01:00
local rep = require("luasnip.extras").rep
2022-11-06 19:05:37 +01:00
2024-04-14 16:09:11 +02:00
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()
2022-10-18 15:32:49 +02:00
ls.add_snippets("markdown", {
2022-11-06 19:05:37 +01:00
s("shrug", {
t [[¯\_(ツ)_/¯]],
2022-10-18 15:32:49 +02:00
}),
})
2022-11-06 19:05:37 +01:00
ls.add_snippets("java", {
s(
"getDescriptionPacket",
fmt(
[[@Override
public Packet getDescriptionPacket() {{
NBTTagCompound nbt = new NBTTagCompound();
{content}
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}}]] ,
{ content = i(1) }
)
),
2022-11-09 14:44:06 +01:00
s("markForUpdate", t [[this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);]]),
2022-11-06 19:05:37 +01:00
})
2022-11-11 18:47:09 +01:00
ls.add_snippets("json", {
s(
"sound",
fmt(
[["{name0}": {{
"category": "master",
"sounds": [
{{
"name": "{name1}",
"stream": false
}}
]
}},]] ,
{
name0 = i(1),
name1 = rep(1),
}
)
),
})
2023-02-11 13:24:42 +01:00
local racket_snippets = {
s("lamb", {
t [[(λ ]],
i(1, "(args)"),
t " ",
i(2, "body..."),
t ")",
}),
}
ls.add_snippets("scheme", racket_snippets)
ls.add_snippets("racket", racket_snippets)