1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
local get_visual = function(args, parent)
if #parent.snippet.env.SELECT_RAW > 0 then
return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
else
return sn(nil, i(1, ""))
end
end
local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" }
-- Return snippet tables
return {
-- LEFT/RIGHT ALL BRACES
s(
{
trig = "([^%a])l([%(%[%{])",
regTrig = true,
wordTrig = false,
snippetType = "autosnippet",
},
fmta("<>\\left<><>\\right<>", {
f(function(_, snip) return snip.captures[1] end),
f(function(_, snip) return snip.captures[2] end),
d(1, get_visual),
f(function(_, snip) return translation_table[snip.captures[2]] end),
})
),
}
|