Update
This commit is contained in:
21
LuaSnip/all.lua
Normal file
21
LuaSnip/all.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
return {
|
||||
s(
|
||||
"date",
|
||||
f(function()
|
||||
return os.date("%D - %H:%M")
|
||||
end)
|
||||
),
|
||||
s("choicenode", c(1, { t("choice 1"), t("choice 2"), t("choice 3") })),
|
||||
}
|
||||
-- test
|
||||
100
LuaSnip/lua.lua
Normal file
100
LuaSnip/lua.lua
Normal file
@@ -0,0 +1,100 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local extras = require("luasnip.extras")
|
||||
local l = extras.lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
return {
|
||||
s(
|
||||
"localreq",
|
||||
fmt('local {} = require("{}")', {
|
||||
l(l._1:match("[^.]*$"):gsub("[^%a]+", "_"), 1),
|
||||
i(1, "module"),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "add", snippetType = "autosnippet" },
|
||||
fmta('["<>"] = "<>",', {
|
||||
i(1),
|
||||
i(2),
|
||||
})
|
||||
),
|
||||
ls.parser.parse_snippet("lm", "local M = {}\n\n$1 \n\nreturn M"),
|
||||
s(
|
||||
{ trig = "csnip", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
s(
|
||||
{ trig = "<>", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\<>{"), i(1), t("}") }), sn(nil, { t("\\<>*{"), i(1), t("{") }) }),
|
||||
{ condition = tex.<> }
|
||||
),
|
||||
]],
|
||||
{ i(1), rep(1), rep(1), c(2, { t("in_text"), t("in_quantikz"), t("in_mathzone") }) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "optsnip", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
s(
|
||||
{ trig = "<>", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\<>{"), i(1), t("}") }), sn(nil, { t("\\<>["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.<> }
|
||||
),
|
||||
]],
|
||||
{ i(1), rep(1), rep(1), c(2, { t("in_quantikz"), t("in_mathzone") }) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "starsnip", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
s(
|
||||
{ trig = "<>", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\<>{"), i(1), t("}") }), sn(nil, { t("\\<>*{"), i(1), t("}") }) }),
|
||||
{ condition = tex.<> }
|
||||
),
|
||||
]],
|
||||
{ i(1), rep(1), rep(1), c(2, { t("in_quantikz"), t("in_mathzone") }) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "fmtasnip", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
s({ trig = "<>", snippetType = "autosnippet" },
|
||||
fmta("\\<>{<<>>}", {
|
||||
<>
|
||||
}),
|
||||
{ condition = tex.<> }),
|
||||
]],
|
||||
{ i(1), rep(1), i(2, "i(1),"), c(3, { t("in_algo"), t("in_quantikz") }) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "tsnip", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
s({ trig = "<>", snippetType = "autosnippet" }, {
|
||||
t("\\<>"),
|
||||
}, { condition = tex.<> }),
|
||||
]],
|
||||
{ i(1), rep(1), c(2, { t("in_mathzone"), t("in_quantikz") }) }
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
}
|
||||
24
LuaSnip/markdown/math.lua
Normal file
24
LuaSnip/markdown/math.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
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 -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
local tex = require("util.latex")
|
||||
|
||||
return {
|
||||
-- s({ trig = "ii", snippetType = "autosnippet" }, fmta("$<>$", i(1))),
|
||||
-- s({ trig = "dd", snippetType = "autosnippet" }, fmta("$$\n<>\n$$", i(1))),
|
||||
}
|
||||
41
LuaSnip/markdown/text.lua
Normal file
41
LuaSnip/markdown/text.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
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 -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s(
|
||||
"link",
|
||||
fmta("[<>](<>)", { i(1), f(function(_, snip)
|
||||
return snip.env.TM_SELECTED_TEXT[1] or {}
|
||||
end, {}) })
|
||||
),
|
||||
s({ trig = ";b", snippetType = "autosnippet" }, fmta("**<>**", i(1))),
|
||||
s({ trig = ";t", snippetType = "autosnippet" }, fmta("*<>*", i(1))),
|
||||
s({ trig = "xx", snippetType = "autosnippet" }, fmta("$\\times$", {})),
|
||||
s(
|
||||
{ trig = ";c", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
```<>
|
||||
<>
|
||||
```
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
}
|
||||
109
LuaSnip/python/manim.lua
Normal file
109
LuaSnip/python/manim.lua
Normal file
@@ -0,0 +1,109 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
return {
|
||||
s(
|
||||
{ trig = "voo", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
with self.voiceover(text="<>") as tracker:
|
||||
<>
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "mte", wordTrig = false },
|
||||
fmta(
|
||||
[[
|
||||
<>_string = "<>"
|
||||
<>_tex = MathTex(r"<>", tex_template=myTemplate)
|
||||
with self.voiceover(text=<>_string) as tracker:
|
||||
self.play(Write(<>_tex))
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
rep(1),
|
||||
i(3),
|
||||
rep(1),
|
||||
rep(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "text", wordTrig = false },
|
||||
fmta(
|
||||
[[
|
||||
<>_string = "<>"
|
||||
<>_text = Text(<>_string)
|
||||
with self.voiceover(text=<>_string) as tracker:
|
||||
self.play(Write(<>_text), run_time=tracker.duration)
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
rep(1),
|
||||
rep(1),
|
||||
rep(1),
|
||||
rep(1),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "spt", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
self.play(Write(<>), run_time=tracker.duration)
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "spd", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
self.play(FadeOut(<>))
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "spp", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
self.play(<>)
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{ trig = "mtex", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
<> = MathTex(r"<>", tex_template=myTemplate)
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
||||
139
LuaSnip/tex/algo.lua
Normal file
139
LuaSnip/tex/algo.lua
Normal file
@@ -0,0 +1,139 @@
|
||||
-- local ls = require("luasnip")
|
||||
-- local s = ls.snippet
|
||||
-- local sn = ls.snippet_node
|
||||
-- local t = ls.text_node
|
||||
-- local i = ls.insert_node
|
||||
-- local f = ls.function_node
|
||||
-- local d = ls.dynamic_node
|
||||
-- local fmta = require("luasnip.extras.fmt").fmta
|
||||
-- local rep = require("luasnip.extras").rep
|
||||
-- local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
-- local tex = require("util.latex")
|
||||
-- local get_visual = function(args, parent)
|
||||
-- if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
-- return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
-- else -- If SELECT_RAW is empty, return a blank insert node
|
||||
-- return sn(nil, i(1))
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- return {
|
||||
-- s(
|
||||
-- { trig = "bal", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \begin{algorithm}
|
||||
-- \caption{<>}
|
||||
-- \label{algo:<>}
|
||||
-- \begin{algorithmic}[1]
|
||||
-- \Require <>
|
||||
-- \end{algorithmic}
|
||||
--
|
||||
-- \end{algorithm}
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- rep(1),
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = line_begin }
|
||||
-- ),
|
||||
-- s({ trig = "ss", snippetType = "autosnippet" }, {
|
||||
-- t("\\State "),
|
||||
-- }, { condition = tex.in_algo * line_begin }),
|
||||
-- s({ trig = "sx", snippetType = "autosnippet" }, {
|
||||
-- t("\\Statex "),
|
||||
-- }, { condition = tex.in_algo * line_begin }),
|
||||
-- s({ trig = "return", snippetType = "autosnippet" }, {
|
||||
-- t("\\Return"),
|
||||
-- }, { condition = tex.in_algo }),
|
||||
-- s(
|
||||
-- { trig = "while", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \While{<>}
|
||||
-- <>
|
||||
-- \EndWhile
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = tex.in_algo * line_begin }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "for", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \For{<>}
|
||||
-- <>
|
||||
-- \EndFor
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = tex.in_algo * line_begin }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "if", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \If{<>}
|
||||
-- <>
|
||||
-- \EndIf
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = tex.in_algo * line_begin }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "elif", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \ElsIf{<>}
|
||||
-- <>
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = tex.in_algo * line_begin }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "else", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \Else
|
||||
-- <>
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = tex.in_algo * line_begin }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "fn", snippetType = "autosnippet" },
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- \Function{<>}{<>}
|
||||
-- <>
|
||||
-- \EndFunction
|
||||
-- ]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- i(2),
|
||||
-- i(0),
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = tex.in_algo * line_begin }
|
||||
-- ),
|
||||
-- }
|
||||
309
LuaSnip/tex/completion.lua
Normal file
309
LuaSnip/tex/completion.lua
Normal file
@@ -0,0 +1,309 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
local tex = require("util.latex")
|
||||
|
||||
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 -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
-- s(
|
||||
-- { trig = "(%a);", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\hat{<>}", {
|
||||
-- f(function(_, snip)
|
||||
-- return snip.captures[1]
|
||||
-- end),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
s(
|
||||
{ trig = "([%a%)%]%}])(%d)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("<>_<>", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
f(function(_, snip)
|
||||
return snip.captures[2]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "([%a%)%]%}])_(%d)(%d)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("<>_{<><>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
f(function(_, snip)
|
||||
return snip.captures[2]
|
||||
end),
|
||||
f(function(_, snip)
|
||||
return snip.captures[3]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "([%a%)%]%}])(%a)%2", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 100 },
|
||||
fmta("<>_<>", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
f(function(_, snip)
|
||||
return snip.captures[2]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "([%a%)%]%}])_(%a)(%a)%3", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("<>_{<><>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
f(function(_, snip)
|
||||
return snip.captures[2]
|
||||
end),
|
||||
f(function(_, snip)
|
||||
return snip.captures[3]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(%d+)/", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 100 },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(%a)/", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 100 },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "%((.+)%)/", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(\\%a+)/", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(\\%a+%{%a+%})/", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 3000 },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "\\%)(%a)", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\) <>", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "\\](%a)", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\] <>", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "lim", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\lim_{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "lsup", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\limsup_{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "linf", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\liminf_{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
-- s(
|
||||
-- { trig = "sum", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\sum\\limits_{<>}^{<>}", {
|
||||
-- i(1),
|
||||
-- i(1),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
s(
|
||||
{ trig = "sum", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\sum_{"), i(1), t("} ") }),
|
||||
sn(nil, { t("\\sum_{"), i(1), t("}^{"), i(2), t("} ") }),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "pd", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\prod_{"), i(1), t("} ") }),
|
||||
sn(nil, { t("\\prod_{"), i(1), t("}^{"), i(2), t("} ") }),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bot", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigotimes_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bcap", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigcap_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bcup", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigcup_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "blor", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigvee_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "band", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigwedge_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bscap", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigsqcap_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bscup", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\bigsqcup_{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "pt", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\int <> \\d P", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "mt", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\int <> d\\mu", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "int", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\int_{<>}^{<>} <> d <>", {
|
||||
i(1),
|
||||
i(2),
|
||||
i(3),
|
||||
i(4),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "2int", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\int_{<>}^{<>}\\int_{<>}^{<>} <> \\d <>\\d <>", {
|
||||
i(1),
|
||||
i(2),
|
||||
i(3),
|
||||
i(4),
|
||||
i(5),
|
||||
i(6),
|
||||
i(7),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "iint", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\iint_{<>}^{<>} <> \\d <>", {
|
||||
i(1, "-\\infty"),
|
||||
i(2, "\\infty"),
|
||||
i(3),
|
||||
i(4),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "lint", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\int_{<>} <> \\d <>", {
|
||||
i(1, "\\infty"),
|
||||
i(2),
|
||||
i(3),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
}
|
||||
58
LuaSnip/tex/derivative.lua
Normal file
58
LuaSnip/tex/derivative.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
-- s(
|
||||
-- { trig = "pv", snippetType = "autosnippet" },
|
||||
-- fmta("\\pdv[order={<>}]{<>}{<>}", {
|
||||
-- i(0),
|
||||
-- i(1),
|
||||
-- i(2),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
s(
|
||||
{ trig = "pv", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\pdv{"), i(1), t("}{"), i(2), t("}") }),
|
||||
sn(nil, { t("\\pdv[order={"), i(3), t("}]{"), i(1), t("}{"), i(2), t("}") }),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "ov", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\odv{"), i(1), t("}{"), i(2), t("}") }),
|
||||
sn(nil, { t("\\odv[order={"), i(3), t("}]{"), i(1), t("}{"), i(2), t("}") }),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "ov", snippetType = "autosnippet" },
|
||||
fmta("\\odv[order={<>}]{<>}{<>}", {
|
||||
i(0),
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
}
|
||||
435
LuaSnip/tex/env.lua
Normal file
435
LuaSnip/tex/env.lua
Normal file
@@ -0,0 +1,435 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
local tex = require("util.latex")
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "mk", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\(<>\)
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "dm", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\[
|
||||
<>
|
||||
\]
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "bad", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{adjustbox}{width=0.<>\textwidth}
|
||||
<>
|
||||
\end{adjustbox}
|
||||
]],
|
||||
{
|
||||
i(1, "8"),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "bp", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{problem}{<>}
|
||||
<>
|
||||
\end{problem}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "equ", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{equation}
|
||||
<>
|
||||
\end{equation}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin * tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "bf", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{proof}
|
||||
<>
|
||||
\end{proof}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin * tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "bep", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{problem}[<>]
|
||||
<>
|
||||
\end{problem}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "bdef", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{definition}
|
||||
<>
|
||||
\end{definition}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "bth", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{theorem}
|
||||
<>
|
||||
\end{theorem}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "bex", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{example}
|
||||
<>
|
||||
\end{example}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "bve", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{verbatim}
|
||||
<>
|
||||
\end{verbatim}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "bbi", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{thebibliography}
|
||||
<>
|
||||
\end{thebibliography}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s({ trig = "bib", snippetType = "autosnippet" }, {
|
||||
t("\\bibitem"),
|
||||
}, { condition = tex.in_bib * line_begin }),
|
||||
s(
|
||||
{ trig = "bfi", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{figure}[htbp]
|
||||
\centering
|
||||
\includegraphics[width=0.5\textwidth]{<>}
|
||||
\caption{<>}
|
||||
\label{fig:<>}
|
||||
\end{figure}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
rep(2),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "beg", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{<>}<>
|
||||
<>
|
||||
\end{<>}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
i(0),
|
||||
rep(1),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "ben", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{enumerate}[<>]
|
||||
\item <>
|
||||
\end{enumerate}
|
||||
]],
|
||||
{
|
||||
i(1, "(a)"),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "blst", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{lstlisting}[language=<>]
|
||||
<>
|
||||
\end{lstlisting}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "box", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{framed}
|
||||
<>
|
||||
\end{framed}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "dcase", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta(
|
||||
[[
|
||||
\begin{dcases}
|
||||
<>
|
||||
\end{dcases}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "case", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{cases}
|
||||
<>
|
||||
\end{cases}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bal", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{aligned}
|
||||
<>
|
||||
\end{aligned}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bal", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta(
|
||||
[[
|
||||
\begin{aligned}
|
||||
<>
|
||||
\end{aligned}
|
||||
]],
|
||||
{
|
||||
d(1, get_visual),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bit", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{itemize}
|
||||
\item <>
|
||||
\end{itemize}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s({ trig = "im", snippetType = "autosnippet" }, {
|
||||
t("\\item"),
|
||||
}, { condition = tex.in_item * line_begin }),
|
||||
s(
|
||||
{ trig = "bcr", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{center}
|
||||
<>
|
||||
\end{center}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "btr", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{tabular}{<>}
|
||||
\hline
|
||||
<>
|
||||
\hline
|
||||
\end{tabular}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "cha", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\chapter{<>}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "par", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\paragraph{<>}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "sec", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\section{"), i(1), t("}") }), sn(nil, { t("\\section*{"), i(1), t("}") }) }),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "ssec", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\subsection{<>}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "sss", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\subsubsection{"), i(1), t("}") }), sn(nil, { t("\\subsubsection*{"), i(1), t("}") }) }),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "sss", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\subsubsection{<>}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin * line_begin }
|
||||
),
|
||||
}
|
||||
145
LuaSnip/tex/font.lua
Normal file
145
LuaSnip/tex/font.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
local ls = require("luasnip")
|
||||
local t = ls.text_node
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local i = ls.insert_node
|
||||
local d = ls.dynamic_node
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "msf", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\mathsf{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "msf", snippetType = "autosnippet" },
|
||||
fmta("\\mathsf{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bf", snippetType = "autosnippet" },
|
||||
fmta("\\mathbf{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "cal", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\mathcal{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "cal", snippetType = "autosnippet" },
|
||||
fmta("\\mathcal{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "scr", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\mathscr{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "scr", snippetType = "autosnippet" },
|
||||
fmta("\\mathscr{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "mbb", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\mathbb{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "mbb", snippetType = "autosnippet" },
|
||||
fmta("\\mathbb{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "mrm", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\mathrm{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "mrm", snippetType = "autosnippet" },
|
||||
fmta("\\mathrm{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "tit", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\textit{<>}", {
|
||||
d(1, get_visual),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "tit", snippetType = "autosnippet" },
|
||||
fmta("\\textit{<>}", {
|
||||
i(0),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "ttt", snippetType = "autosnippet" },
|
||||
fmta("\\texttt{<>}", {
|
||||
i(0),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "tbf", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\textbf{<>}", {
|
||||
d(1, get_visual),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "tbf", snippetType = "autosnippet" },
|
||||
fmta("\\textbf{<>}", {
|
||||
i(0),
|
||||
})
|
||||
),
|
||||
s(
|
||||
{ trig = "qq", snippetType = "autosnippet" },
|
||||
fmta("\\text{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "tet", snippetType = "autosnippet" },
|
||||
fmta("\\text{<>}", {
|
||||
i(1),
|
||||
})
|
||||
),
|
||||
s({ trig = "CC", snippetType = "autosnippet" },
|
||||
t("\\mathbb{C}"),
|
||||
{ condition = tex.in_mathzone() }),
|
||||
}
|
||||
172
LuaSnip/tex/greek-letter.lua
Normal file
172
LuaSnip/tex/greek-letter.lua
Normal file
@@ -0,0 +1,172 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local tex = require("util.latex")
|
||||
|
||||
return {
|
||||
s({ trig = "alp", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\alpha"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Alp", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Alpha"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = ";a", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\alpha"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "beta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\beta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = ";b", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\beta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Beta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Beta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "gam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\gamma"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = ";c", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\gamma"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Gam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Gamma"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "del", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\delta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = ";d", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\delta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Del", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Delta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "eps", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\epsilon"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "vps", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\varepsilon"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Eps", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Epsilon"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "zeta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\zeta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Zeta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Zeta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "eta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\eta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Eta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Eta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "the", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\theta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "The", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Theta"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "iot", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\iota"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Iot", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Iota"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "kap", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\kappa"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Kap", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Kappa"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "lam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\lambda"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Lam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Lambda"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "mu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\mu"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Mu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Mu"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "nu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\nu"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Nu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Nu"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "xi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
-- t("\\xi"),
|
||||
-- }, { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "Xi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
-- t("\\Xi"),
|
||||
-- }, { condition = tex.in_mathzone }),
|
||||
s({ trig = "omi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\omicron"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "pi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\pi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\pii", snippetType = "autosnippet", wordTrig = false, priority = 2000 }, {
|
||||
t("p_i"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Pi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Pi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "rho", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\rho"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Rho", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Rho"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "sig", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\sigma"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Sig", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Sigma"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "tau", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\tau"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Tau", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Tau"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ups", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\ups"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Ups", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Ups"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "phi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\phi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Phi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Phi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "vhi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\varphi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Vhi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Varphi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "chi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\chi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Chi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Chi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "psi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\psi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Psi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Psi"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ome", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\omega"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "Ome", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Omega"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
}
|
||||
426
LuaSnip/tex/math-commands.lua
Normal file
426
LuaSnip/tex/math-commands.lua
Normal file
@@ -0,0 +1,426 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s({ trig = "sin", snippetType = "autosnippet" }, {
|
||||
t("\\sin"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "asin", snippetType = "autosnippet" }, {
|
||||
t("\\arcsin"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cos", snippetType = "autosnippet" }, {
|
||||
t("\\cos"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "acos", snippetType = "autosnippet" }, {
|
||||
t("\\arccos"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "tan", snippetType = "autosnippet" }, {
|
||||
t("\\tan"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "atan", snippetType = "autosnippet" }, {
|
||||
t("\\arctan"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cot", snippetType = "autosnippet" }, {
|
||||
t("\\cot"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "acot", snippetType = "autosnippet" }, {
|
||||
t("\\arccot"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "csc", snippetType = "autosnippet" }, {
|
||||
t("\\csc"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "acsc", snippetType = "autosnippet" }, {
|
||||
t("\\arccsc"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "sec", snippetType = "autosnippet" }, {
|
||||
t("\\sec"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "asec", snippetType = "autosnippet" }, {
|
||||
t("\\arcsec"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "log", snippetType = "autosnippet" }, {
|
||||
t("\\log"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ln", snippetType = "autosnippet" }, {
|
||||
t("\\ln"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "exp", snippetType = "autosnippet" }, {
|
||||
t("\\exp"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "grad", snippetType = "autosnippet" }, {
|
||||
t("\\grad"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "curl", snippetType = "autosnippet" }, {
|
||||
t("\\curl"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "div", snippetType = "autosnippet" }, {
|
||||
t("\\div"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "lap", snippetType = "autosnippet" }, {
|
||||
t("\\laplacian"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbr", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{R}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbq", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{Q}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbh", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{H}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbc", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{C}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbz", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{Z}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbn", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{N}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bb1", snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\mathbbm{1}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "bbe", snippetType = "autosnippet" }, {
|
||||
t("\\mathbb{E}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "bb(%w)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\mathbb{<>}", {
|
||||
f(function(_, snip)
|
||||
return string.upper(snip.captures[1])
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(%w)cal", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\mathcal{<>}", {
|
||||
f(function(_, snip)
|
||||
return string.upper(snip.captures[1])
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "exp", snippetType = "autosnippet" }, {
|
||||
t("\\exp"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cv", snippetType = "autosnippet" }, fmta("\\conv", {}), { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "br", snippetType = "autosnippet" },
|
||||
fmta("\\bar{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bar", snippetType = "autosnippet" },
|
||||
fmta("\\overline{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(%a)bar", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||
fmta("\\overline{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "ob", snippetType = "autosnippet" },
|
||||
fmta("\\overbrace{<>}^{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "ob", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\overbrace{<>}^{<>}", {
|
||||
d(1, get_visual),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "td", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\tilde{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "td", snippetType = "autosnippet" },
|
||||
fmta("\\ttlde{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(\\%a+)~", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||
fmta("\\tilde{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "(%a)~", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
|
||||
fmta("\\tilde{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "dot", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\dot{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "dot", snippetType = "autosnippet" },
|
||||
fmta("\\dot{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "doo", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\ddot{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "vb", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\vb{"), i(1), t("}") }), sn(nil, { t("\\vb*{"), i(1), t("}") }) }),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "vu", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\vu{"), i(1), t("}") }), sn(nil, { t("\\vu*{"), i(1), t("}") }) }),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "hat", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\hat{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "hat", snippetType = "autosnippet" },
|
||||
fmta("\\hat{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "vec", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\vec{<>}", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = ";v", snippetType = "autosnippet" },
|
||||
fmta("\\vec{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "vec", snippetType = "autosnippet" },
|
||||
fmta("\\vec{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "rr", snippetType = "autosnippet" }, fmta("\\Range", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "kk", snippetType = "autosnippet" }, fmta("\\ker", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "tr", snippetType = "autosnippet" }, fmta("\\tr", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "span", snippetType = "autosnippet" }, fmta("\\Span", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "aut", snippetType = "autosnippet" }, fmta("\\Aut", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "gal", snippetType = "autosnippet" }, fmta("\\Gal", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "rank", snippetType = "autosnippet" }, fmta("\\rank", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "dim", snippetType = "autosnippet" }, fmta("\\dim", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "det", snippetType = "autosnippet" }, fmta("\\det", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "vol", snippetType = "autosnippet" }, fmta("\\Vol", {}), { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "->", snippetType = "autosnippet" },
|
||||
fmta("\\xlongrightarrow{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "<-", snippetType = "autosnippet" },
|
||||
fmta("\\xlongleftarrow{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "--", snippetType = "autosnippet" }, fmta("\\longleftrightarrow", {}), { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "gt", snippetType = "autosnippet" },
|
||||
fmta("\\gt{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "min", snippetType = "autosnippet" }, fmta("\\min", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "max", snippetType = "autosnippet" }, fmta("\\max", {}), { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "amin", snippetType = "autosnippet" },
|
||||
fmta("\\argmin_{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "amax", snippetType = "autosnippet" },
|
||||
fmta("\\argmax_{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "sup", snippetType = "autosnippet", priority = 2000 }, fmta("\\sup", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "inf", snippetType = "autosnippet", priority = 2000 }, fmta("\\inf", {}), { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = ";r", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = ";r", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\frac{<>}{<>}", {
|
||||
d(1, get_visual),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = ";i", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\langle <>, <> \\rangle", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
|
||||
s(
|
||||
{ trig = "binom", snippetType = "autosnippet" },
|
||||
fmta("\\binom{<>}{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
-- s({ trig = "dd", snippetType = "autosnippet" }, fmta("\\d ", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "poly", snippetType = "autosnippet" }, fmta("\\poly", {}), { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "sq", wordTrig = false, snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\sqrt{"), i(1), t("}") }), sn(nil, { t("\\sqrt["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "mod", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\mod{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "nmod", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\nmod{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "pmod", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\pmod{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "sgn", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\sgn", {}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "SI", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\SI{<>}{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "cond", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\cond(<>)", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "cqty", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\complexqty{<>}{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "gcd", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\gcd", {}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "abs", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\abs{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "deg", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("\\degree", {}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "pr", wordTrig = false, snippetType = "autosnippet" }, fmta("\\Pr", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "sch", snippetType = "autosnippet" }, {
|
||||
t("\\Sch"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\Pii", snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("P_i"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
}
|
||||
137
LuaSnip/tex/matrix.lua
Normal file
137
LuaSnip/tex/matrix.lua
Normal file
@@ -0,0 +1,137 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
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 -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "bmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{bmatrix}
|
||||
<>
|
||||
\end{bmatrix}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "Bmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{Bmatrix}
|
||||
<>
|
||||
\end{Bmatrix}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "pmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{pmatrix}
|
||||
<>
|
||||
\end{pmatrix}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "Vmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{Vmatrix}
|
||||
<>
|
||||
\end{Vmatrix}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "Bmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\Bmat{<>}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "dmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\bdiagmat{<>}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "vmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\vmat{<>}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "Vmat", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\Vmat{<>}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "pma(%a)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\pmat<>{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
}
|
||||
305
LuaSnip/tex/physics.lua
Normal file
305
LuaSnip/tex/physics.lua
Normal file
@@ -0,0 +1,305 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
-- -- s(
|
||||
-- -- { trig = "qb", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\qty(<>)", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "qb", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\qty(<>)", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "qB", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\qty{<>}", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "qB", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\qty{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "qp", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\qty[<>]", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "qp", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\qty[<>]", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "mb", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\mqty(<>)", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "mB", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\mqty{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "mp", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\mqty[<>]", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "im", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\imat{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "xm", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\xmat{<>}{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(2),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "zm", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\zmat{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "pmat", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\pmat{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "dm", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\dmat{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "adm", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\admat{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "comm", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\comm{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "acom", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\acomm{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "ket", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\ket{<>}", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "ket", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\ket{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "bra", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\bra{<>}", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "bra", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\bra{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "norm", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\norm{<>}", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "norm", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\norm{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "abs", snippetType = "autosnippet", priority = 2000 },
|
||||
-- -- fmta("\\abs{<>}", {
|
||||
-- -- d(1, get_visual),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "abs", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\abs*{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "vu", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\vu{<>}", {
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "bk", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\ip{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "kb", snippetType = "autosnippet" },
|
||||
-- -- fmta("\\op{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- s(
|
||||
-- { trig = "ev", snippetType = "autosnippet" },
|
||||
-- fmta("\\ev{<>}", {
|
||||
-- i(0),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "mev", snippetType = "autosnippet" },
|
||||
-- fmta("\\ev{<>}{<>}", {
|
||||
-- i(1),
|
||||
-- i(0),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "mel", snippetType = "autosnippet" },
|
||||
-- fmta("\\mel{<>}{<>}{<>}", {
|
||||
-- i(1),
|
||||
-- i(2),
|
||||
-- i(0),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "mdet", snippetType = "autosnippet" },
|
||||
-- fmta("\\mdet{<>}", {
|
||||
-- i(0),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "ord", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\order{<>}", {
|
||||
-- i(0),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "qif", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\qif", {}),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "qq", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\qq{<>}", {
|
||||
-- i(0),
|
||||
-- }),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "qor", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\qor", {}),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- s(
|
||||
-- { trig = "qif", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- fmta("\\qif", {}),
|
||||
-- { condition = tex.in_mathzone }
|
||||
-- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "dv", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- -- fmta("\\dv[<>]{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(2),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- -- s(
|
||||
-- -- { trig = "pv", wordTrig = false, snippetType = "autosnippet" },
|
||||
-- -- fmta("\\pdv{<>}{<>}", {
|
||||
-- -- i(1),
|
||||
-- -- i(0),
|
||||
-- -- }),
|
||||
-- -- { condition = tex.in_mathzone }
|
||||
-- -- ),
|
||||
-- s({ trig = "tr", wordTrig = false, snippetType = "autosnippet" }, fmta("\\tr", {}), { condition = tex.in_mathzone }),
|
||||
}
|
||||
104
LuaSnip/tex/physics2.lua
Normal file
104
LuaSnip/tex/physics2.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "bra", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\bra{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "ket", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\ket{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bk", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\braket{"), i(1), t("}{"), i(2), t("}") }),
|
||||
sn(nil, { t("\\braket[3]{"), i(1), t("}{"), i(2), t("}{"), i(3), t("}") }),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "ev", snippetType = "autosnippet" },
|
||||
fmta("\\braket[1]{<>}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "kb", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\ketbra{"), i(1), t("}{"), i(2), t("}") }),
|
||||
sn(nil, { t("\\ketbra{"), i(1), t("}["), i(2), t("]{"), i(3), t("}") }),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "pab", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\ab( <> )", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "Bab", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\ab\\{ <> \\}", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "bab", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\ab[ <> ]", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "\\forallb", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\ab<< <> >>", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "vab", wordTrig = false, snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\ab|"), i(1), t("|") }), sn(nil, { t("\\ab*|"), i(1), t("|") }) }),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "norm", wordTrig = false, snippetType = "autosnippet", priority = 1000 },
|
||||
fmta("\\| <> \\|", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "\\tof", snippetType = "autosnippet" }, {
|
||||
t("\\Tof"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
}
|
||||
297
LuaSnip/tex/py.lua
Normal file
297
LuaSnip/tex/py.lua
Normal file
@@ -0,0 +1,297 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
local tex = require("util.latex")
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "sym", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("sympy <> sympy", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "sym", wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||
fmta("sympy <> sympy", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s( -- This one evaluates anything inside the simpy block
|
||||
{ trig = "sympy.*sympys", regTrig = true, desc = "Sympy block evaluator", snippetType = "autosnippet" },
|
||||
d(1, function(_, parent)
|
||||
local to_eval = string.gsub(parent.trigger, "^sympy(.*)sympys", "%1")
|
||||
to_eval = string.gsub(to_eval, "^%s+(.*)%s+$", "%1")
|
||||
|
||||
local Job = require("plenary.job")
|
||||
|
||||
local sympy_script = string.format(
|
||||
[[
|
||||
from latex2sympy2 import latex2latex
|
||||
import re
|
||||
origin = r'%s'
|
||||
# remove white space
|
||||
standard = re.sub(r"\\d", "d", origin)
|
||||
latex = latex2latex(standard)
|
||||
output = origin + " = " + latex
|
||||
print(output)
|
||||
]],
|
||||
to_eval
|
||||
)
|
||||
|
||||
sympy_script = string.gsub(sympy_script, "^[\t%s]+", "")
|
||||
local result = ""
|
||||
|
||||
Job:new({
|
||||
command = "python3",
|
||||
args = {
|
||||
"-c",
|
||||
sympy_script,
|
||||
},
|
||||
on_exit = function(j)
|
||||
result = j:result()
|
||||
end,
|
||||
}):sync()
|
||||
|
||||
return sn(nil, t(result))
|
||||
end)
|
||||
),
|
||||
s( -- This one evaluates anything inside the simpy block
|
||||
{ trig = "sympy.*sympy ", regTrig = true, desc = "Sympy block evaluator", snippetType = "autosnippet" },
|
||||
d(1, function(_, parent)
|
||||
-- Gets the part of the block we actually want, and replaces spaces
|
||||
-- at the beginning and at the end
|
||||
local to_eval = string.gsub(parent.trigger, "^sympy(.*)sympy", "%1")
|
||||
to_eval = string.gsub(to_eval, "^%s+(.*)%s+$", "%1")
|
||||
local pattern = { "\\ab" }
|
||||
local repl = { "" }
|
||||
for i = 1, #pattern do
|
||||
to_eval = string.gsub(to_eval, pattern[i], repl[i])
|
||||
end
|
||||
|
||||
local Job = require("plenary.job")
|
||||
|
||||
local sympy_script = string.format(
|
||||
[[
|
||||
from sympy import *
|
||||
from latex2sympy2 import latex2sympy, latex2latex
|
||||
import re
|
||||
origin = r'%s'
|
||||
origin = re.sub(r"\\d", "d", origin)
|
||||
latex = latex2latex(origin)
|
||||
print(latex)
|
||||
]],
|
||||
to_eval
|
||||
)
|
||||
|
||||
sympy_script = string.gsub(sympy_script, "^[\t%s]+", "")
|
||||
local result = ""
|
||||
|
||||
Job:new({
|
||||
command = "python3",
|
||||
args = {
|
||||
"-c",
|
||||
sympy_script,
|
||||
},
|
||||
on_exit = function(j)
|
||||
result = j:result()
|
||||
end,
|
||||
}):sync()
|
||||
|
||||
return sn(nil, t(result))
|
||||
end)
|
||||
),
|
||||
s(
|
||||
{ trig = "qcircuit", wordTrig = false },
|
||||
fmta("QCircuit <> QCircuit", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "qcircuit", wordTrig = false, priority = 2000 },
|
||||
fmta("QCircuit <> QCircuit", {
|
||||
d(1, get_visual),
|
||||
}),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s( -- This one evaluates anything inside the simpy block
|
||||
{ trig = "QCircuit.*QCircuit ", regTrig = true, desc = "QCircuit block evaluator", snippetType = "autosnippet" },
|
||||
d(1, function(_, parent)
|
||||
-- Gets the part of the block we actually want, and replaces spaces
|
||||
-- at the beginning and at the end
|
||||
local to_eval = string.gsub(parent.trigger, "^QCircuit(.*)QCircuit ", "%1")
|
||||
to_eval = string.gsub(to_eval, "^%s+(.*)%s+$", "%1")
|
||||
|
||||
-- Replace lash with rash for to_evil
|
||||
local pattern = {
|
||||
"ts",
|
||||
"I_?(%d)",
|
||||
"C(%w)",
|
||||
"dagger",
|
||||
"\\ket{0}",
|
||||
"\\ket{1}",
|
||||
"\\ket{%+}",
|
||||
"\\ket{%-}",
|
||||
"\\ket{%+i}",
|
||||
"\\ket{i}",
|
||||
"\\ket{%-i}",
|
||||
"\\bra{0}",
|
||||
"\\bra{1}",
|
||||
"\\bra{%+}",
|
||||
"\\bra{%-}",
|
||||
"\\bra{%+i}",
|
||||
"\\bra{i}",
|
||||
"\\bra{%-i}",
|
||||
}
|
||||
local repl = {
|
||||
"TensorProduct",
|
||||
"eye(%1)",
|
||||
"controlled_gate_12(%1)",
|
||||
".conjugate().transpose()",
|
||||
"ket0",
|
||||
"ket1",
|
||||
"ketp",
|
||||
"ketm",
|
||||
"ketpi",
|
||||
"ketpi",
|
||||
"ketmi",
|
||||
"bra0",
|
||||
"bra1",
|
||||
"brap",
|
||||
"bram",
|
||||
"brapi",
|
||||
"brapi",
|
||||
"brami",
|
||||
}
|
||||
for i = 1, #pattern do
|
||||
to_eval = string.gsub(to_eval, pattern[i], repl[i])
|
||||
end
|
||||
print(to_eval)
|
||||
|
||||
local Job = require("plenary.job")
|
||||
|
||||
local sympy_script = string.format(
|
||||
[[
|
||||
from sympy import *
|
||||
from sympy.physics.quantum import *
|
||||
def controlled_gate_12(gate):
|
||||
return TensorProduct(Matrix([ [1, 0], [0, 0] ]), eye(2))+TensorProduct(Matrix([ [0, 0], [0, 1] ]), gate)
|
||||
def controlled_gate_21(gate):
|
||||
return TensorProduct(eye(2), Matrix([ [1, 0], [0, 0] ]))+TensorProduct(gate, Matrix([ [0, 0], [0, 1] ]))
|
||||
H = Matrix([ [1, 1], [1, -1] ]) / sqrt(2)
|
||||
X = Matrix([ [0, 1], [1, 0] ])
|
||||
Y = Matrix([ [0, -I], [I, 0] ])
|
||||
Z = Matrix([ [1, 0], [0, -1] ])
|
||||
e1 = Matrix([ [1], [0], [0], [0] ])
|
||||
e2 = Matrix([ [0], [1], [0], [0] ])
|
||||
e3 = Matrix([ [0], [0], [1], [0] ])
|
||||
e4 = Matrix([ [0], [0], [0], [1] ])
|
||||
ket0 = Matrix([ [1], [0] ])
|
||||
ket1 = Matrix([ [0], [1] ])
|
||||
ketp = Matrix([ [1], [1] ]) / sqrt(2)
|
||||
ketm = Matrix([ [1], [-1] ]) / sqrt(2)
|
||||
ketpi = Matrix([ [1], [I] ]) / sqrt(2)
|
||||
ketmi = Matrix([ [1], [-I] ]) / sqrt(2)
|
||||
bra0 = Matrix([ [1, 0] ])
|
||||
bra1 = Matrix([ [0, 1] ])
|
||||
brap = Matrix([ [1, 1] ]) / sqrt(2)
|
||||
bram = Matrix([ [1, -1] ]) / sqrt(2)
|
||||
brapi = Matrix([ [1, -I] ]) / sqrt(2)
|
||||
brami = Matrix([ [1, I] ]) / sqrt(2)
|
||||
out00 = e1*e1.transpose()
|
||||
out01 = e2*e2.transpose()
|
||||
out10 = e3*e3.transpose()
|
||||
out11 = e4*e4.transpose()
|
||||
%s
|
||||
output = latex(res)
|
||||
print(output)
|
||||
]],
|
||||
to_eval
|
||||
)
|
||||
|
||||
sympy_script = string.gsub(sympy_script, "^[\t%s]+", "")
|
||||
local result = ""
|
||||
|
||||
Job:new({
|
||||
command = "python3",
|
||||
args = {
|
||||
"-c",
|
||||
sympy_script,
|
||||
},
|
||||
on_exit = function(j)
|
||||
result = j:result()
|
||||
end,
|
||||
}):sync()
|
||||
|
||||
return sn(nil, t(result))
|
||||
end)
|
||||
),
|
||||
s(
|
||||
{ trig = "exd", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("expand <> expand", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s( -- This one evaluates anything inside the simpy block
|
||||
{ trig = "expand.*expand ", regTrig = true, desc = "expand block evaluator", snippetType = "autosnippet" },
|
||||
d(1, function(_, parent)
|
||||
-- Gets the part of the block we actually want, and replaces spaces
|
||||
-- at the beginning and at the end
|
||||
local to_eval = string.gsub(parent.trigger, "^expand(.*)expand ", "%1")
|
||||
to_eval = string.gsub(to_eval, "^%s+(.*)%s+$", "%1")
|
||||
local pattern = { "\\ab" }
|
||||
local repl = { "" }
|
||||
for i = 1, #pattern do
|
||||
to_eval = string.gsub(to_eval, pattern[i], repl[i])
|
||||
end
|
||||
|
||||
local Job = require("plenary.job")
|
||||
|
||||
local sympy_script = string.format(
|
||||
[[
|
||||
from sympy import *
|
||||
from latex2sympy2 import latex2sympy, latex2latex
|
||||
x, y = symbols('x y')
|
||||
theta = symbols('theta')
|
||||
origin = r'%s'
|
||||
expand = latex2sympy(origin).expand()
|
||||
print(latex(expand))
|
||||
]],
|
||||
to_eval
|
||||
)
|
||||
|
||||
sympy_script = string.gsub(sympy_script, "^[\t%s]+", "")
|
||||
local result = ""
|
||||
|
||||
Job:new({
|
||||
command = "python3",
|
||||
args = {
|
||||
"-c",
|
||||
sympy_script,
|
||||
},
|
||||
on_exit = function(j)
|
||||
result = j:result()
|
||||
end,
|
||||
}):sync()
|
||||
|
||||
return sn(nil, t(result))
|
||||
end)
|
||||
),
|
||||
}
|
||||
301
LuaSnip/tex/quantikz.lua
Normal file
301
LuaSnip/tex/quantikz.lua
Normal file
@@ -0,0 +1,301 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "bqu", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{quantikz}
|
||||
& <>
|
||||
\end{quantikz}
|
||||
]],
|
||||
{
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "cl", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\ctrl{"), i(1), t("}") }), sn(nil, { t("\\ctrl["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "ocl", snippetType = "autosnippet", priority = 2000 },
|
||||
c(1, { sn(nil, { t("\\octrl{"), i(1), t("}") }), sn(nil, { t("\\octrl["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "tar", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\targ{"), i(1), t("}") }), sn(nil, { t("\\targX{"), i(1), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "gate", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\gate{"), i(1), t("}") }), sn(nil, { t("\\gate["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "g(%a)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\gate{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "wire", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\wire["), i(1), t("]{"), i(2), t("}") }), sn(nil, { t("\\wire{"), i(1), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "mt", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\meter{"), i(1), t("}") }), sn(nil, { t("\\meter["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "phase", snippetType = "autosnippet" },
|
||||
fmta("\\phase{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "swap", snippetType = "autosnippet" },
|
||||
fmta("\\swap{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "ls", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\lstick{"), i(1), t("}") }), sn(nil, { t("\\lstick["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "rs", snippetType = "autosnippet" },
|
||||
c(1, { sn(nil, { t("\\rstick{"), i(1), t("}") }), sn(nil, { t("\\rstick["), i(1), t("]{"), i(2), t("}") }) }),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "group", snippetType = "autosnippet" },
|
||||
fmta("\\gategroup[<>,steps=<>]{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "slice", snippetType = "autosnippet" },
|
||||
fmta("\\slice{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "push", snippetType = "autosnippet" },
|
||||
fmta("\\push{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "ms", snippetType = "autosnippet" },
|
||||
c(1, {
|
||||
sn(nil, { t("\\measure{"), i(1), t("}") }),
|
||||
sn(nil, { t("\\measuretab{"), i(1), t("}") }),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "ket", snippetType = "autosnippet" },
|
||||
fmta("\\ket{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "bra", snippetType = "autosnippet" },
|
||||
fmta("\\bra{<>}", {
|
||||
i(0),
|
||||
}),
|
||||
{ condition = tex.in_quantikz }
|
||||
),
|
||||
s({ trig = "alp", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\alpha"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Alp", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Alpha"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "beta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\beta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Beta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Beta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "gam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\gamma"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Gam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Gamma"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "del", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\delta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Del", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Delta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "eps", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\epsilon"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "vps", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\varepsilon"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Eps", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Epsilon"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "zeta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\zeta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Zeta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Zeta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "eta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\eta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Eta", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Eta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "the", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\theta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "The", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Theta"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "iot", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\iota"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Iot", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Iota"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "kap", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\kappa"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Kap", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Kappa"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "lam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\lambda"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Lam", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Lambda"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "mu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\mu"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Mu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Mu"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "nu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\nu"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Nu", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Nu"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
-- s({ trig = "xi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
-- t("\\xi"),
|
||||
-- }, { condition = tex.in_quantikz }),
|
||||
-- s({ trig = "Xi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
-- t("\\Xi"),
|
||||
-- }, { condition = tex.in_quantikz }),
|
||||
s({ trig = "omi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\omicron"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "pi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\pi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "\\pii", snippetType = "autosnippet", wordTrig = false, priority = 2000 }, {
|
||||
t("p_i"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Pi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Pi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "rho", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\rho"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Rho", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Rho"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "sig", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\sigma"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Sig", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Sigma"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "tau", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\tau"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Tau", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Tau"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "ups", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\ups"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Ups", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Ups"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "phi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\phi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Phi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Phi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "vhi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\varphi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Vhi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Varphi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "chi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\chi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Chi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Chi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "psi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\psi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Psi", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Psi"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "ome", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\omega"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
s({ trig = "Ome", snippetType = "autosnippet", wordTrig = false }, {
|
||||
t("\\Omega"),
|
||||
}, { condition = tex.in_quantikz }),
|
||||
}
|
||||
|
||||
266
LuaSnip/tex/symbol-short.lua
Normal file
266
LuaSnip/tex/symbol-short.lua
Normal file
@@ -0,0 +1,266 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
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 -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s({ trig = "...", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\dots"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "c.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\cdot"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\cdot.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\cdots"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "v.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\vdot"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\vdot.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\vdots"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "d.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\ddot"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\ddot.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\ddots"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "iff", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\iff"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "inn", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\in"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "notin", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("not\\in"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "aa", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\forall"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ee", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\exists"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "!=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\neq"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "==", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("&="),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\leq=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("&\\leq"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\geq=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("&\\geq"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "~=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\approx"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "~~", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\sim"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = ">=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\geq"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "<=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\leq"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = ">>", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\gg"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "<<", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\ll"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cp", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\cp"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "get", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\gets"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "to", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\to"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\>", wordTrig = false, snippetType = "autosnippet", priority = 1001 }, {
|
||||
t("\\mapsto"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\\\\\", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\setminus"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "||", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\mid"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "mid", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\mid"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "nmid", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\nmid"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "sr", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^2"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cb", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^3"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "inv", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^{-1}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "**", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^*"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = " ", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\,"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "<>", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\diamond"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "+-", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\pm"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "-+", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\mp"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "rhs", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\mathrm{R.H.S}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "lhs", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\mathrm{L.H.S}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cap", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\cap"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cup", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\cup"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "sub", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\subseteq"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "sup", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
-- t("\\supseteq"),
|
||||
-- }, { condition = tex.in_mathzone }),
|
||||
s({ trig = "oo", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\infty"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "tp", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^\\top"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "dr", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^\\dagger"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "perp", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("^\\perp"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ss", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\star"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "xx", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\times"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "=>", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\implies"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "=<", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\impliedby"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "llr", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\longleftrightarrow"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "up", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\uparrow"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cir", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\circ"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "iso", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\cong"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ihbar", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("i\\hbar"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "hbar", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\hbar"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ns", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\unlhd"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "eqv", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\equiv"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "##", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\#"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ell", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\ell"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ot", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\otimes"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "op", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\oplus"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "od", wordTrig = false, snippetType = "autosnippet" }, {
|
||||
t("\\odot"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "not", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\not"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "par", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\partial"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "land", snippetType = "autosnippet" }, {
|
||||
t("\\land"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "lor", snippetType = "autosnippet" }, {
|
||||
t("\\lor"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\tri", snippetType = "autosnippet" }, {
|
||||
t("\\triangle"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "emp", snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\emptyset"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "po", snippetType = "autosnippet" }, {
|
||||
-- t("\\propto"),
|
||||
-- }, { condition = tex.in_mathzone }),
|
||||
s({ trig = "neg", snippetType = "autosnippet" }, {
|
||||
t("\\neg"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "nabla", snippetType = "autosnippet" }, {
|
||||
t("\\nabla"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "jo", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
_{<>}
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "kj", wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
^{<>}
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
}
|
||||
96
LuaSnip/tex/temporary.lua
Normal file
96
LuaSnip/tex/temporary.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local d = ls.dynamic_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
local tex = require("util.latex")
|
||||
|
||||
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 -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
-- s({ trig = "sp", snippetType = "autosnippet" }, fmta("\\hat{\\$}", {}), { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "T", snippetType = "autosnippet" }, fmta("\\mathcal{T}", {}), { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "tv", snippetType = "autosnippet" }, fmta("\\mathrm{TV}", {}), { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "ce", snippetType = "autosnippet" }, fmta("\\mathrm{couple}", {}), { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "mix", snippetType = "autosnippet" }, fmta("\\mathrm{mix}", {}), { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\psii", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\psi_i"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "FF", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\mathcal{F}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "SS", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\mathcal{S}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "EE", snippetType = "autosnippet" },
|
||||
fmta("\\E_{\\sigma} \\ab[ <> ]", {
|
||||
i(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "\\varphii", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\varphi_i"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "cc", snippetType = "autosnippet" }, {
|
||||
t("^c"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "--", snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("^-"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\oplust", snippetType = "autosnippet", priority = 2000 }, {
|
||||
t("\\OPT"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "++", snippetType = "autosnippet" }, {
|
||||
t("^+"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ii", snippetType = "autosnippet" }, {
|
||||
t("\\int"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "ed", snippetType = "autosnippet" }, {
|
||||
t("\\ed"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "cas", snippetType = "autosnippet", priority = 2000 }, {
|
||||
-- t("\\cas"),
|
||||
-- }, { condition = tex.in_mathzone }),
|
||||
s({ trig = "lr", snippetType = "autosnippet" }, {
|
||||
t("\\leftrightarrow"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "sa", snippetType = "autosnippet" }, {
|
||||
t("s_A"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "sb", snippetType = "autosnippet" }, {
|
||||
t("s_B"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "(%a);", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||
fmta("\\hat{<>}", {
|
||||
f(function(_, snip)
|
||||
return snip.captures[1]
|
||||
end),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "\\psi;", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\tilde{\\psi}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "\\varphi;", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\tilde{\\varphi}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "IS", snippetType = "autosnippet", priority = 3000 }, {
|
||||
t("\\mathcal{IS}"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
}
|
||||
256
LuaSnip/tex/text.lua
Normal file
256
LuaSnip/tex/text.lua
Normal file
@@ -0,0 +1,256 @@
|
||||
local ls = require("luasnip")
|
||||
local c = ls.choice_node
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local tex = require("util.latex")
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
return {
|
||||
s(
|
||||
{ trig = "DeclareMathOperator" },
|
||||
fmta("\\DeclareMathOperator{\\<>}{<>}", {
|
||||
i(1),
|
||||
rep(1),
|
||||
}),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s({ trig = "dps", snippetType = "autosnippet" }, {
|
||||
t("\\displaystyle"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
-- s({ trig = "if", snippetType = "autosnippet" }, {
|
||||
-- t("\\text{\\ if\\ }"),
|
||||
-- }, { condition = tex.in_mathzone }),
|
||||
s({ trig = "stt", snippetType = "autosnippet" }, {
|
||||
t("\\quad\\text{s.t.}\\quad"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "as", snippetType = "autosnippet" }, {
|
||||
t("\\text{\\ as\\ }"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "or", snippetType = "autosnippet" }, { t("\\text{\\ or\\ }") }, { condition = tex.in_mathzone }),
|
||||
s({ trig = "otherwise", snippetType = "autosnippet" }, {
|
||||
t("\\text{\\ otherwise\\ }"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "then", snippetType = "autosnippet" }, {
|
||||
t("\\text{\\ then\\ }"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "since", snippetType = "autosnippet" }, {
|
||||
t("\\text{\\ since\\ }"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "by", snippetType = "autosnippet" }, {
|
||||
t("\\text{\\ by\\ }"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "and", snippetType = "autosnippet" }, {
|
||||
t("\\text{\\ and\\ }"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s({ trig = "qd", snippetType = "autosnippet" }, {
|
||||
t("\\quad"),
|
||||
}, { condition = tex.in_mathzone }),
|
||||
s(
|
||||
{ trig = "setc", snippetType = "autosnippet" },
|
||||
fmta("\\setcounter{<>}{<>}", {
|
||||
c(1, { t("exer"), t("theorem") }),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "PP", snippetType = "autosnippet" },
|
||||
fmta("\\section*{Problem <>}", { i(1) }),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
|
||||
-- s({ trig = "label", snippetType = "autosnippet" }, {
|
||||
-- t("\\label{"),
|
||||
-- i(0),
|
||||
-- t("}"),
|
||||
-- }, { condition = tex.in_text, show_condition = tex.in_text }),
|
||||
s(
|
||||
{ trig = "href", snippetType = "autosnippet" },
|
||||
fmta("\\href{<>}{<>}", {
|
||||
i(1),
|
||||
i(2),
|
||||
}),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
|
||||
s({ trig = "wlog", snippetType = "autosnippet" }, {
|
||||
t("without loss of generality"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "Wlog", snippetType = "autosnippet" }, {
|
||||
t("Without loss of generality"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "%%", snippetType = "autosnippet" }, {
|
||||
t("\\%"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "&&", snippetType = "autosnippet" }, {
|
||||
t("\\&"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "##", snippetType = "autosnippet" }, {
|
||||
t("\\#"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "thm", snippetType = "autosnippet" }, {
|
||||
t("theorem"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "propp", snippetType = "autosnippet" }, {
|
||||
t("proposition"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "deff", snippetType = "autosnippet" }, {
|
||||
t("definition"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "exaa", snippetType = "autosnippet" }, {
|
||||
t("example"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "iee", snippetType = "autosnippet" }, {
|
||||
t("i.e."),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "stt", snippetType = "autosnippet" }, {
|
||||
t("such that"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "iff", snippetType = "autosnippet" }, {
|
||||
t("if and only if"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "iso" }, {
|
||||
t("isomorphic"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "iso" }, {
|
||||
t("isomorphism"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "homo" }, {
|
||||
t("homomorphism"),
|
||||
}, { condition = tex.in_text }),
|
||||
s({ trig = "homo" }, {
|
||||
t("homomorphic"),
|
||||
}, { condition = tex.in_text }),
|
||||
-- s({ trig = "psp", snippetType = "autosnippet" }, {
|
||||
-- t("\\(p\\)-subgroup"),
|
||||
-- }, { condition = tex.in_text }),
|
||||
-- s({ trig = "pgp", snippetType = "autosnippet" }, {
|
||||
-- t("\\(p\\)-subgroup"),
|
||||
-- }, { condition = tex.in_text }),
|
||||
-- s({ trig = "spsp", snippetType = "autosnippet" }, {
|
||||
-- t("Sylow \\(p\\)-subgroup"),
|
||||
-- }, { condition = tex.in_text }),
|
||||
s({ trig = "=>", snippetType = "autosnippet" }, {
|
||||
t("\\(\\implies\\)"),
|
||||
}, { condition = tex.in_text }),
|
||||
s(
|
||||
{ trig = "homework" },
|
||||
fmta(
|
||||
[[
|
||||
\documentclass{article}
|
||||
\newcommand{\Class}{<>}
|
||||
\newcommand{\Title}{Homework <>}
|
||||
\author{Hanyu Yan}
|
||||
\input{~/Documents/Latex/Package_elegantbook.tex}
|
||||
\input{~/Documents/Latex/Sample_Homework.tex}
|
||||
\begin{document}
|
||||
\maketitle \thispagestyle{empty}
|
||||
|
||||
<>
|
||||
|
||||
\end{document}
|
||||
]],
|
||||
{
|
||||
c(1, {
|
||||
t("Numerical Analysis"),
|
||||
t("Experimental Quantum Information Processing"),
|
||||
t("Quantum Communication and Cryptography"),
|
||||
}),
|
||||
i(2, "number"),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "note" },
|
||||
fmta(
|
||||
[[
|
||||
\documentclass[letterpaper, 12pt]{article}
|
||||
\input{~/Documents/Latex/note_template.tex}
|
||||
\begin{document}
|
||||
\title{<> \\[1em]
|
||||
\normalsize <>}
|
||||
\author{\normalsize Fireond}
|
||||
\date{\normalsize\vspace{-1ex} Last updated: \today}
|
||||
\maketitle
|
||||
\tableofcontents\label{sec:contents}
|
||||
|
||||
<>
|
||||
|
||||
\end{document}
|
||||
]],
|
||||
{
|
||||
i(1, "title"),
|
||||
i(2, "subtitle"),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "algo" },
|
||||
fmta(
|
||||
[[
|
||||
\documentclass[utf8]{article}
|
||||
\usepackage{amsmath,amssymb}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{fullpage}
|
||||
\usepackage{setspace}
|
||||
\usepackage{verbatim}
|
||||
\usepackage{algorithm}
|
||||
\usepackage{algpseudocodex}
|
||||
\algrenewcommand\algorithmicrequire{\textbf{Input:}}
|
||||
\algrenewcommand\algorithmicensure{\textbf{Output:}}
|
||||
\input{~/Documents/Latex/Package_elegantbook.tex}
|
||||
|
||||
\onehalfspacing
|
||||
|
||||
\title{\bf\huge Algorithm Design - Assignment <>}
|
||||
\author{Hanyu Yan\\2022010860\\Class 23}
|
||||
\date{\today}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
|
||||
<>
|
||||
|
||||
\end{document}
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "report" },
|
||||
fmta(
|
||||
[[
|
||||
%! TeX program = xelatex
|
||||
\documentclass{article}
|
||||
\newcommand{\Class}{<>}
|
||||
\newcommand{\Title}{<>}
|
||||
\author{严涵宇}
|
||||
\usepackage[UTF8]{ctex}
|
||||
\input{~/Documents/Latex/Package_elegantbook.tex}
|
||||
\input{~/Documents/Latex/Sample_Homework.tex}
|
||||
\begin{document}
|
||||
\maketitle \thispagestyle{empty}
|
||||
|
||||
<>
|
||||
|
||||
\end{document}
|
||||
]],
|
||||
{
|
||||
c(1, {
|
||||
t("量子信息实验报告"),
|
||||
}),
|
||||
i(2),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text * line_begin }
|
||||
),
|
||||
}
|
||||
178
LuaSnip/tex/tikz.lua
Normal file
178
LuaSnip/tex/tikz.lua
Normal file
@@ -0,0 +1,178 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local t = ls.text_node
|
||||
local f = ls.function_node
|
||||
local i = ls.insert_node
|
||||
local d = ls.dynamic_node
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
local tex = require("util.latex")
|
||||
|
||||
local get_visual = function(args, parent)
|
||||
if #parent.snippet.env.SELECT_RAW > 0 then
|
||||
return sn(nil, t(parent.snippet.env.SELECT_RAW))
|
||||
else -- If SELECT_RAW is empty, return a blank insert node
|
||||
return sn(nil, i(1))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
s({ trig = "vsp", snippetType = "autosnippet" }, {
|
||||
t("\\vspace{\\baselineskip}"),
|
||||
}),
|
||||
s(
|
||||
{ trig = "bti", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\begin{tikzpicture}<>
|
||||
<>
|
||||
\end{tikzpicture}
|
||||
]],
|
||||
{
|
||||
c(1, { t("[overlay,remember picture,>=stealth,nodes={align=left,inner ysep=1pt},<-]"), t("") }),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = line_begin }
|
||||
),
|
||||
s(
|
||||
{ trig = "tm", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\tikzmarknode{<>}{<>}
|
||||
]],
|
||||
{
|
||||
i(1, "markname"),
|
||||
i(0),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_tikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "tm", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta(
|
||||
[[
|
||||
\tikzmarknode{<>}{<>}
|
||||
]],
|
||||
{
|
||||
i(1, "markname"),
|
||||
d(2, get_visual),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "lu", snippetType = "autosnippet", dscr = "Left up annotate" },
|
||||
fmta(
|
||||
[[
|
||||
\path (<>.north) ++ (0,1em) node[anchor=south east,color=<>!67] (<>_node){<>};
|
||||
\draw [color=<>!57](<>.north) |- ([xshift=-0.3ex,color=<>]<>_node.south west);
|
||||
]],
|
||||
{
|
||||
i(1, "markname"),
|
||||
i(2, "color"),
|
||||
rep(1),
|
||||
i(3, "text"),
|
||||
rep(2),
|
||||
rep(1),
|
||||
rep(2),
|
||||
rep(1),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_tikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "rd", snippetType = "autosnippet", dscr = "Right down annotate" },
|
||||
fmta(
|
||||
[[
|
||||
\path (<>.south) ++ (0,-0.8em) node[anchor=north west,color=<>!67] (<>_node){<>};
|
||||
\draw [color=<>!57](<>.south) |- ([xshift=-0.3ex,color=<>]<>_node.south east);
|
||||
]],
|
||||
{
|
||||
i(1, "markname"),
|
||||
i(2, "color"),
|
||||
rep(1),
|
||||
i(3, "text"),
|
||||
rep(2),
|
||||
rep(1),
|
||||
rep(2),
|
||||
rep(1),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_tikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "ld", snippetType = "autosnippet", dscr = "Left down annotate" },
|
||||
fmta(
|
||||
[[
|
||||
\path (<>.south) ++ (0,-0.8em) node[anchor=north east,color=<>!67] (<>_node){<>};
|
||||
\draw [color=<>!57](<>.south) |- ([xshift=-0.3ex,color=<>]<>_node.south west);
|
||||
]],
|
||||
{
|
||||
i(1, "markname"),
|
||||
i(2, "color"),
|
||||
rep(1),
|
||||
i(3, "text"),
|
||||
rep(2),
|
||||
rep(1),
|
||||
rep(2),
|
||||
rep(1),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_tikz }
|
||||
),
|
||||
s(
|
||||
{ trig = "hl", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\hlmath{<>}{<>}
|
||||
]],
|
||||
{
|
||||
i(1, "red"),
|
||||
i(2),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "hl", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta(
|
||||
[[
|
||||
\hlmath{<>}{<>}
|
||||
]],
|
||||
{
|
||||
i(1, "red"),
|
||||
d(2, get_visual),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_mathzone }
|
||||
),
|
||||
s(
|
||||
{ trig = "hl", snippetType = "autosnippet" },
|
||||
fmta(
|
||||
[[
|
||||
\hltext{<>}{<>}
|
||||
]],
|
||||
{
|
||||
i(1, "red"),
|
||||
i(2),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
s(
|
||||
{ trig = "hl", snippetType = "autosnippet", priority = 2000 },
|
||||
fmta(
|
||||
[[
|
||||
\hltext{<>}{<>}
|
||||
]],
|
||||
{
|
||||
i(1, "red"),
|
||||
d(2, get_visual),
|
||||
}
|
||||
),
|
||||
{ condition = tex.in_text }
|
||||
),
|
||||
}
|
||||
Reference in New Issue
Block a user