Update
This commit is contained in:
@@ -120,9 +120,6 @@ return {
|
|||||||
s({ trig = "**", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "**", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("^*"),
|
t("^*"),
|
||||||
}, { condition = tex.in_mathzone_md }),
|
}, { condition = tex.in_mathzone_md }),
|
||||||
s({ trig = " ", wordTrig = false, snippetType = "autosnippet" }, {
|
|
||||||
t("\\,"),
|
|
||||||
}, { condition = tex.in_mathzone_md }),
|
|
||||||
s({ trig = "<>", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "<>", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("\\diamond"),
|
t("\\diamond"),
|
||||||
}, { condition = tex.in_mathzone_md }),
|
}, { condition = tex.in_mathzone_md }),
|
||||||
@@ -222,9 +219,6 @@ return {
|
|||||||
s({ trig = "lor", snippetType = "autosnippet" }, {
|
s({ trig = "lor", snippetType = "autosnippet" }, {
|
||||||
t("\\lor"),
|
t("\\lor"),
|
||||||
}, { condition = tex.in_mathzone_md }),
|
}, { condition = tex.in_mathzone_md }),
|
||||||
s({ trig = "\\tri", snippetType = "autosnippet" }, {
|
|
||||||
t("\\triangle"),
|
|
||||||
}, { condition = tex.in_mathzone_md }),
|
|
||||||
s({ trig = "emp", snippetType = "autosnippet", priority = 2000 }, {
|
s({ trig = "emp", snippetType = "autosnippet", priority = 2000 }, {
|
||||||
t("\\emptyset"),
|
t("\\emptyset"),
|
||||||
}, { condition = tex.in_mathzone_md }),
|
}, { condition = tex.in_mathzone_md }),
|
||||||
@@ -263,7 +257,7 @@ return {
|
|||||||
{ condition = tex.in_mathzone_md }
|
{ condition = tex.in_mathzone_md }
|
||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "jk", wordTrig = false, snippetType = "autosnippet" },
|
{ trig = "jo", wordTrig = false, snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
_{<>}
|
_{<>}
|
||||||
|
|||||||
@@ -106,11 +106,11 @@ return {
|
|||||||
s({ trig = "=>", snippetType = "autosnippet" }, {
|
s({ trig = "=>", snippetType = "autosnippet" }, {
|
||||||
t("$\\implies$"),
|
t("$\\implies$"),
|
||||||
}, { condition = tex.in_text }),
|
}, { condition = tex.in_text }),
|
||||||
s({ trig = "<=", snippetType = "autosnippet" }, {
|
s({ trig = "=<", snippetType = "autosnippet" }, {
|
||||||
t("$\\impliedby$"),
|
t("$\\impliedby$"),
|
||||||
}, { condition = tex.in_text }),
|
}, { condition = tex.in_text }),
|
||||||
s(
|
s(
|
||||||
{ trig = "(%a)ii", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
{ trig = "(%a)mk", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
fmta("$<>$", {
|
fmta("$<>$", {
|
||||||
f(function(_, snip)
|
f(function(_, snip)
|
||||||
return snip.captures[1]
|
return snip.captures[1]
|
||||||
|
|||||||
@@ -88,6 +88,20 @@ return {
|
|||||||
),
|
),
|
||||||
{ condition = line_begin * tex.in_text }
|
{ condition = line_begin * tex.in_text }
|
||||||
),
|
),
|
||||||
|
s(
|
||||||
|
{ trig = "bsol", snippetType = "autosnippet" },
|
||||||
|
fmta(
|
||||||
|
[[
|
||||||
|
\begin{solution}
|
||||||
|
<>
|
||||||
|
\end{solution}
|
||||||
|
]],
|
||||||
|
{
|
||||||
|
i(0),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
{ condition = line_begin * tex.in_text }
|
||||||
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "bf", snippetType = "autosnippet" },
|
{ trig = "bf", snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
@@ -230,12 +244,11 @@ return {
|
|||||||
{ trig = "ben", snippetType = "autosnippet" },
|
{ trig = "ben", snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{enumerate}[<>]
|
\begin{enumerate}
|
||||||
\item <>
|
\item <>
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1, "(a)"),
|
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -133,12 +133,6 @@ return {
|
|||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ condition = tex.in_mathzone }
|
||||||
),
|
),
|
||||||
s(
|
|
||||||
{ trig = "tet", snippetType = "autosnippet" },
|
|
||||||
fmta("\\text{<>}", {
|
|
||||||
i(1),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
s({ trig = "CC", snippetType = "autosnippet" },
|
s({ trig = "CC", snippetType = "autosnippet" },
|
||||||
t("\\mathbb{C}"),
|
t("\\mathbb{C}"),
|
||||||
{ condition = tex.in_mathzone() }),
|
{ condition = tex.in_mathzone() }),
|
||||||
|
|||||||
@@ -176,24 +176,6 @@ return {
|
|||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ 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(
|
s(
|
||||||
{ trig = "dot", snippetType = "autosnippet", priority = 2000 },
|
{ trig = "dot", snippetType = "autosnippet", priority = 2000 },
|
||||||
fmta("\\dot{<>}", {
|
fmta("\\dot{<>}", {
|
||||||
|
|||||||
@@ -1,301 +0,0 @@
|
|||||||
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 }),
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
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 }),
|
|
||||||
}
|
|
||||||
@@ -136,121 +136,7 @@ return {
|
|||||||
s({ trig = "=>", snippetType = "autosnippet" }, {
|
s({ trig = "=>", snippetType = "autosnippet" }, {
|
||||||
t("\\(\\implies\\)"),
|
t("\\(\\implies\\)"),
|
||||||
}, { condition = tex.in_text }),
|
}, { condition = tex.in_text }),
|
||||||
s(
|
s({ trig = "=<", snippetType = "autosnippet" }, {
|
||||||
{ trig = "homework" },
|
t("\\(\\impliedby\\)"),
|
||||||
fmta(
|
}, { condition = tex.in_text }),
|
||||||
[[
|
|
||||||
\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 }
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,139 +0,0 @@
|
|||||||
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 = tex.in_text * 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 }
|
|
||||||
),
|
|
||||||
}
|
|
||||||
@@ -83,56 +83,6 @@ return {
|
|||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ 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(
|
s(
|
||||||
{ trig = "%)(%a)", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
{ trig = "%)(%a)", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||||
fmta(") <>", {
|
fmta(") <>", {
|
||||||
@@ -170,22 +120,22 @@ return {
|
|||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ condition = tex.in_mathzone }
|
||||||
),
|
),
|
||||||
-- s(
|
|
||||||
-- { trig = "sum", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
|
||||||
-- fmta("sumlimits_(<>)^(<>)", {
|
|
||||||
-- i(1),
|
|
||||||
-- i(1),
|
|
||||||
-- }),
|
|
||||||
-- { condition = tex.in_mathzone }
|
|
||||||
-- ),
|
|
||||||
s(
|
s(
|
||||||
{ trig = "sum", snippetType = "autosnippet" },
|
{ trig = "sum", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
c(1, {
|
fmta("sum_(<>)^(<>)", {
|
||||||
sn(nil, { t("sum_{"), i(1), t("} ") }),
|
i(1),
|
||||||
sn(nil, { t("sum_{"), i(1), t("}^{"), i(2), t("} ") }),
|
i(2),
|
||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ 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(
|
s(
|
||||||
{ trig = "pd", snippetType = "autosnippet" },
|
{ trig = "pd", snippetType = "autosnippet" },
|
||||||
c(1, {
|
c(1, {
|
||||||
@@ -252,7 +202,7 @@ return {
|
|||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "int", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
{ trig = "int", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
fmta("integral_(<>)^(<>) <> dif <>", {
|
fmta("integral<>_(<>)^(<>) <>", {
|
||||||
i(1),
|
i(1),
|
||||||
i(2),
|
i(2),
|
||||||
i(3),
|
i(3),
|
||||||
@@ -262,11 +212,10 @@ return {
|
|||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "oint", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
{ trig = "oint", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||||
fmta("ointegral_(<>)^(<>) <> dif <>", {
|
fmta("integral.cont_(<>)^(<>) <> ", {
|
||||||
i(1),
|
i(1),
|
||||||
i(2),
|
i(2),
|
||||||
i(3),
|
i(3),
|
||||||
i(4),
|
|
||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ condition = tex.in_mathzone }
|
||||||
),
|
),
|
||||||
@@ -285,7 +234,7 @@ return {
|
|||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "iint", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
{ trig = "iint", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
||||||
fmta("iintegral_(<>)^(<>) <> dif <>", {
|
fmta("integral.double_(<>)^(<>) <> dif <>", {
|
||||||
i(1, "-infty"),
|
i(1, "-infty"),
|
||||||
i(2, "infty"),
|
i(2, "infty"),
|
||||||
i(3),
|
i(3),
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
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 }
|
|
||||||
),
|
|
||||||
}
|
|
||||||
@@ -45,29 +45,12 @@ return {
|
|||||||
{ condition = tex.in_text }
|
{ condition = tex.in_text }
|
||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "(%d+)bp", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
|
{ trig = "#thm", snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{homeworkProblem}[Problem <>.]
|
#theorem(<>)[
|
||||||
<>
|
<>
|
||||||
\end{homeworkProblem}
|
]
|
||||||
]],
|
|
||||||
{
|
|
||||||
f(function(_, snip)
|
|
||||||
return snip.captures[1]
|
|
||||||
end),
|
|
||||||
i(0),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
{ condition = line_begin }
|
|
||||||
),
|
|
||||||
s(
|
|
||||||
{ trig = "bp", snippetType = "autosnippet" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
\begin{homeworkProblem}[Problem <>.]
|
|
||||||
<>
|
|
||||||
\end{homeworkProblem}
|
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1),
|
i(1),
|
||||||
@@ -77,26 +60,26 @@ return {
|
|||||||
{ condition = line_begin }
|
{ condition = line_begin }
|
||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "bff", snippetType = "autosnippet" },
|
{ trig = "#pf", snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{proof}
|
#proof[
|
||||||
<>
|
<>
|
||||||
\end{proof}
|
]
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
{ condition = line_begin * tex.in_text }
|
{ condition = tex.in_text }
|
||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "bep", snippetType = "autosnippet" },
|
{ trig = "#def", snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{problem}[<>]
|
#definition(<>)[
|
||||||
<>
|
<>
|
||||||
\end{problem}
|
]
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1),
|
i(1),
|
||||||
@@ -106,332 +89,17 @@ return {
|
|||||||
{ condition = line_begin }
|
{ condition = line_begin }
|
||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "bex", snippetType = "autosnippet" },
|
{ trig = "#exa", snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
\begin{exercise}[<>]
|
#example[
|
||||||
<>
|
<>
|
||||||
\end{exercise}
|
]
|
||||||
]],
|
|
||||||
{
|
|
||||||
i(1),
|
|
||||||
i(0),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
{ condition = line_begin }
|
|
||||||
),
|
|
||||||
s(
|
|
||||||
{ trig = "bve", snippetType = "autosnippet" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
\begin{verbatim}
|
|
||||||
<>
|
|
||||||
\end{verbatim}
|
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(0),
|
i(0),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
{ condition = line_begin }
|
{ 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.8\textwidth]{<>}
|
|
||||||
\caption{<>}
|
|
||||||
\label{fig:<>}
|
|
||||||
\end{figure}
|
|
||||||
]],
|
|
||||||
{
|
|
||||||
i(1),
|
|
||||||
i(2),
|
|
||||||
rep(2),
|
|
||||||
}
|
|
||||||
),
|
|
||||||
{ condition = line_begin }
|
|
||||||
),
|
|
||||||
s(
|
|
||||||
{ trig = "bmf", snippetType = "autosnippet" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
\begin{figure}[htbp]
|
|
||||||
\centering
|
|
||||||
\begin{minipage}[t]{0.48\textwidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[width=6cm]{}
|
|
||||||
\caption{}
|
|
||||||
\label{fig:}
|
|
||||||
\end{minipage}
|
|
||||||
\begin{minipage}[t]{0.48\textwidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[width=6cm]{}
|
|
||||||
\caption{}
|
|
||||||
\label{fig:}
|
|
||||||
\end{minipage}
|
|
||||||
\end{figure}
|
|
||||||
]],
|
|
||||||
{}
|
|
||||||
),
|
|
||||||
{ 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 = "bta", snippetType = "autosnippet" },
|
|
||||||
fmta(
|
|
||||||
[[
|
|
||||||
\begin{table}[htbp]
|
|
||||||
\centering
|
|
||||||
\begin{tabular}{<>}
|
|
||||||
\hline
|
|
||||||
<>
|
|
||||||
\hline
|
|
||||||
\end{tabular}
|
|
||||||
\caption{<>}
|
|
||||||
\label{tab:<>}
|
|
||||||
\end{table}
|
|
||||||
]],
|
|
||||||
{
|
|
||||||
i(1),
|
|
||||||
i(2),
|
|
||||||
i(3),
|
|
||||||
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" },
|
|
||||||
c(1, { sn(nil, { t("\\subsection{"), i(1), t("}") }), sn(nil, { t("\\subsection*{"), i(1), t("}") }) }),
|
|
||||||
{ condition = tex.in_text * 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 }
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
local ls = require("luasnip")
|
|
||||||
local s = ls.snippet
|
|
||||||
local sn = ls.snippet_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 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", wordTrig = false, snippetType = "autosnippet" },
|
|
||||||
fmta("\\text{<>}", {
|
|
||||||
i(1),
|
|
||||||
}),
|
|
||||||
{ condition = tex.in_mathzone }
|
|
||||||
),
|
|
||||||
s(
|
|
||||||
{ trig = "tet", snippetType = "autosnippet" },
|
|
||||||
fmta("\\text{<>}", {
|
|
||||||
i(1),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
}
|
|
||||||
@@ -52,6 +52,9 @@ return {
|
|||||||
s({ trig = "zeta", snippetType = "autosnippet", wordTrig = false }, {
|
s({ trig = "zeta", snippetType = "autosnippet", wordTrig = false }, {
|
||||||
t("zeta"),
|
t("zeta"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
|
s({ trig = ";z", snippetType = "autosnippet", wordTrig = false }, {
|
||||||
|
t("zeta"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "Zeta", snippetType = "autosnippet", wordTrig = false }, {
|
s({ trig = "Zeta", snippetType = "autosnippet", wordTrig = false }, {
|
||||||
t("Zeta"),
|
t("Zeta"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
|
|||||||
@@ -42,6 +42,22 @@ return {
|
|||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ condition = tex.in_mathzone }
|
||||||
),
|
),
|
||||||
|
s(
|
||||||
|
{ trig = "td", snippetType = "autosnippet"},
|
||||||
|
fmta("tilde(<>)", {
|
||||||
|
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(
|
s(
|
||||||
{ trig = "ob", snippetType = "autosnippet" },
|
{ trig = "ob", snippetType = "autosnippet" },
|
||||||
fmta("overbrace(<>)", {
|
fmta("overbrace(<>)", {
|
||||||
@@ -84,6 +100,31 @@ return {
|
|||||||
}),
|
}),
|
||||||
{ condition = tex.in_mathzone }
|
{ condition = tex.in_mathzone }
|
||||||
),
|
),
|
||||||
|
s(
|
||||||
|
{ trig = "mrm", snippetType = "autosnippet" },
|
||||||
|
fmta("upright(<>)", {
|
||||||
|
i(1),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{ trig = "bb(%w)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("bb(<>)", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return string.upper(snip.captures[1])
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
|
s(
|
||||||
|
{ trig = "cal(%w)", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
|
||||||
|
fmta("cal(<>)", {
|
||||||
|
f(function(_, snip)
|
||||||
|
return string.upper(snip.captures[1])
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
{ condition = tex.in_mathzone }
|
||||||
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "vec", snippetType = "autosnippet", priority = 2000 },
|
{ trig = "vec", snippetType = "autosnippet", priority = 2000 },
|
||||||
fmta("vec(<>)", {
|
fmta("vec(<>)", {
|
||||||
@@ -115,28 +156,6 @@ return {
|
|||||||
s({ trig = "dim", snippetType = "autosnippet" }, fmta("dim", {}), { 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 = "det", snippetType = "autosnippet" }, fmta("det", {}), { condition = tex.in_mathzone }),
|
||||||
s({ trig = "vol", snippetType = "autosnippet" }, fmta("Vol", {}), { 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 = "min", snippetType = "autosnippet" }, fmta("min", {}), { condition = tex.in_mathzone }),
|
||||||
s({ trig = "max", snippetType = "autosnippet" }, fmta("max", {}), { condition = tex.in_mathzone }),
|
s({ trig = "max", snippetType = "autosnippet" }, fmta("max", {}), { condition = tex.in_mathzone }),
|
||||||
s(
|
s(
|
||||||
@@ -157,7 +176,7 @@ return {
|
|||||||
s({ trig = "inf", snippetType = "autosnippet", priority = 2000 }, fmta("inf", {}), { condition = tex.in_mathzone }),
|
s({ trig = "inf", snippetType = "autosnippet", priority = 2000 }, fmta("inf", {}), { condition = tex.in_mathzone }),
|
||||||
s(
|
s(
|
||||||
{ trig = ";r", wordTrig = false, snippetType = "autosnippet" },
|
{ trig = ";r", wordTrig = false, snippetType = "autosnippet" },
|
||||||
fmta("frac(<>)(<>)", {
|
fmta("(<>)/(<>)", {
|
||||||
i(1),
|
i(1),
|
||||||
i(2),
|
i(2),
|
||||||
}),
|
}),
|
||||||
@@ -165,7 +184,7 @@ return {
|
|||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = ";r", snippetType = "autosnippet", priority = 2000 },
|
{ trig = ";r", snippetType = "autosnippet", priority = 2000 },
|
||||||
fmta("frac(<>)(<>)", {
|
fmta("(<>)/(<>)", {
|
||||||
d(1, get_visual),
|
d(1, get_visual),
|
||||||
i(2),
|
i(2),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,297 +0,0 @@
|
|||||||
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,a,b = symbols('x y a b')
|
|
||||||
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)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
@@ -21,6 +21,9 @@ local get_visual = function(args, parent)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
s({ trig = "!in", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
|
t("in.not"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "...", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "...", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("dots"),
|
t("dots"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
@@ -33,6 +36,9 @@ return {
|
|||||||
s({ trig = "v.", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "v.", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("dots.v"),
|
t("dots.v"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
|
s({ trig = "to", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
|
t("->"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "iff", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "iff", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("iff"),
|
t("iff"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
@@ -45,15 +51,6 @@ return {
|
|||||||
s({ trig = "ee", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "ee", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("exists"),
|
t("exists"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { 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("&>="),
|
|
||||||
}, { condition = tex.in_mathzone }),
|
|
||||||
s({ trig = "~=", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "~=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("approx"),
|
t("approx"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
@@ -78,9 +75,6 @@ return {
|
|||||||
s({ trig = "mto", wordTrig = false, snippetType = "autosnippet", priority = 1001 }, {
|
s({ trig = "mto", wordTrig = false, snippetType = "autosnippet", priority = 1001 }, {
|
||||||
t("mapsto"),
|
t("mapsto"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "||", wordTrig = false, snippetType = "autosnippet" }, {
|
|
||||||
t("mid"),
|
|
||||||
}, { condition = tex.in_mathzone }),
|
|
||||||
s({ trig = "mid", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "mid", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("mid"),
|
t("mid"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
@@ -94,22 +88,19 @@ return {
|
|||||||
t("^3"),
|
t("^3"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "inv", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "inv", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("^{-1}"),
|
t("^(-1)"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "**", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "**", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("^*"),
|
t("^*"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = " ", wordTrig = false, snippetType = "autosnippet" }, {
|
|
||||||
t(","),
|
|
||||||
}, { condition = tex.in_mathzone }),
|
|
||||||
s({ trig = "<>", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "<>", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("diamond"),
|
t("diamond"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "+-", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "+-", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("pm"),
|
t("plus.minus"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "-+", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "-+", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("mp"),
|
t("minus.plus"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "rhs", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "rhs", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("mathrm{R.H.S}"),
|
t("mathrm{R.H.S}"),
|
||||||
@@ -124,9 +115,15 @@ return {
|
|||||||
t("union"),
|
t("union"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "sub", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "sub", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("subset.eq"),
|
t("subset"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "suq", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "subset=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
|
t("supset.eq"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
s({ trig = "sup", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
|
t("supset"),
|
||||||
|
}, { condition = tex.in_mathzone }),
|
||||||
|
s({ trig = "supset=", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("supset.eq"),
|
t("supset.eq"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "tp", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "tp", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
@@ -144,9 +141,6 @@ return {
|
|||||||
s({ trig = "xx", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "xx", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("times"),
|
t("times"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "=>", wordTrig = false, snippetType = "autosnippet" }, {
|
|
||||||
t("implies"),
|
|
||||||
}, { condition = tex.in_mathzone }),
|
|
||||||
s({ trig = "llr", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "llr", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("longleftrightarrow"),
|
t("longleftrightarrow"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
@@ -180,7 +174,7 @@ return {
|
|||||||
s({ trig = "ell", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
s({ trig = "ell", wordTrig = false, snippetType = "autosnippet", priority = 2000 }, {
|
||||||
t("ell"),
|
t("ell"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "ot", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "ox", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
t("times.circle"),
|
t("times.circle"),
|
||||||
}, { condition = tex.in_mathzone }),
|
}, { condition = tex.in_mathzone }),
|
||||||
s({ trig = "op", wordTrig = false, snippetType = "autosnippet" }, {
|
s({ trig = "op", wordTrig = false, snippetType = "autosnippet" }, {
|
||||||
@@ -218,7 +212,7 @@ return {
|
|||||||
{ condition = tex.in_mathzone }
|
{ condition = tex.in_mathzone }
|
||||||
),
|
),
|
||||||
s(
|
s(
|
||||||
{ trig = "jk", wordTrig = false, snippetType = "autosnippet" },
|
{ trig = "jo", wordTrig = false, snippetType = "autosnippet" },
|
||||||
fmta(
|
fmta(
|
||||||
[[
|
[[
|
||||||
_(<>)
|
_(<>)
|
||||||
|
|||||||
72
LuaSnip/typst/text.lua
Normal file
72
LuaSnip/typst/text.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
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 = "if", snippetType = "autosnippet" }, {
|
||||||
|
-- t("\\text{\\ if\\ }"),
|
||||||
|
-- }, { condition = tex.in_mathzone }),
|
||||||
|
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 }),
|
||||||
|
}
|
||||||
@@ -1,43 +1,46 @@
|
|||||||
{
|
{
|
||||||
"LazyVim": { "branch": "main", "commit": "b4606f9df3395a261bb6a09acc837993da5d8bfc" },
|
"CopilotChat.nvim": { "branch": "main", "commit": "481db772c752fa029329194a2bc2c2073356a05a" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "b3104910bb5ebf40492aadffae18f2528fa757d9" },
|
"LazyVim": { "branch": "main", "commit": "060e6dfaf7d4157b1a144df7d83179640dc52400" },
|
||||||
"SchemaStore.nvim": { "branch": "main", "commit": "22f0c2f7c727a15b45b7bfcbbab533720223b840" },
|
"LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" },
|
||||||
"aerial.nvim": { "branch": "master", "commit": "c7cbbad40c2065fccfd1f1863bb2c08180c0533d" },
|
"SchemaStore.nvim": { "branch": "main", "commit": "c8af3f44c68757344b4dcb82e2ac48892b1be765" },
|
||||||
|
"aerial.nvim": { "branch": "master", "commit": "5e687b5a14004fa2dd9eccbee042b96869fe1557" },
|
||||||
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
|
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
|
||||||
"avante.nvim": { "branch": "main", "commit": "26e40e5483db90c593bf09466bc6cbe5a7711381" },
|
"avante.nvim": { "branch": "main", "commit": "26e40e5483db90c593bf09466bc6cbe5a7711381" },
|
||||||
"blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" },
|
"blink-copilot": { "branch": "main", "commit": "5d35fd07fcc148be20442da1bdd2407e03263d7d" },
|
||||||
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||||
"catppuccin": { "branch": "main", "commit": "f19cab18ec4dc86d415512c7a572863b2adbcc18" },
|
"catppuccin": { "branch": "main", "commit": "c89184526212e04feffbddda9d06b041a8fca416" },
|
||||||
"chezmoi.nvim": { "branch": "main", "commit": "e0b3ebafd910b63acdfbf6677b44b03eb3d09f19" },
|
"chezmoi.nvim": { "branch": "main", "commit": "e0b3ebafd910b63acdfbf6677b44b03eb3d09f19" },
|
||||||
"chezmoi.vim": { "branch": "main", "commit": "ca5f2ed602046d5662cb76d845c4b510aae0ce84" },
|
"chezmoi.vim": { "branch": "main", "commit": "ca5f2ed602046d5662cb76d845c4b510aae0ce84" },
|
||||||
"clangd_extensions.nvim": { "branch": "main", "commit": "b67cc417d9020fb4b83d46662351b4d16894905e" },
|
"clangd_extensions.nvim": { "branch": "main", "commit": "b67cc417d9020fb4b83d46662351b4d16894905e" },
|
||||||
"cmake-tools.nvim": { "branch": "master", "commit": "88e07c6bff838a5bda2f461e9c1122b79ff0829f" },
|
"cmake-tools.nvim": { "branch": "master", "commit": "88e07c6bff838a5bda2f461e9c1122b79ff0829f" },
|
||||||
"code_runner.nvim": { "branch": "main", "commit": "a0aa4325ea2958ba21d77d181a838e74be6267cd" },
|
"code_runner.nvim": { "branch": "main", "commit": "a0aa4325ea2958ba21d77d181a838e74be6267cd" },
|
||||||
"competitest.nvim": { "branch": "master", "commit": "b42c06ca308906f07912ba9aff015ac2c0831f85" },
|
"competitest.nvim": { "branch": "master", "commit": "b42c06ca308906f07912ba9aff015ac2c0831f85" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" },
|
"conform.nvim": { "branch": "master", "commit": "c64cc754ace603e185ab30113aaef174187eacf8" },
|
||||||
"copilot.lua": { "branch": "master", "commit": "af3114aeb915beb14fcbc46849c7b08a5e3e2c1a" },
|
"copilot.lua": { "branch": "master", "commit": "3cd5086c28c5769f5db147721f457a3e081de254" },
|
||||||
|
"cord.nvim": { "branch": "master", "commit": "1aadec47743e6cfe77ae6860a5b4305a465f03be" },
|
||||||
"dial.nvim": { "branch": "master", "commit": "f0404ec1f83a03f2c3457e60087c6331d1cbb83f" },
|
"dial.nvim": { "branch": "master", "commit": "f0404ec1f83a03f2c3457e60087c6331d1cbb83f" },
|
||||||
"flash.nvim": { "branch": "main", "commit": "b68bda044d68e4026c4e1ec6df3c5afd7eb8e341" },
|
"flash.nvim": { "branch": "main", "commit": "b68bda044d68e4026c4e1ec6df3c5afd7eb8e341" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" },
|
"gitsigns.nvim": { "branch": "main", "commit": "18ec9a862741453e0f47f28155728b11c992b5f4" },
|
||||||
"grug-far.nvim": { "branch": "main", "commit": "50d9ee2b5a19634670441948e7e4afaa042f1059" },
|
"grug-far.nvim": { "branch": "main", "commit": "48f9afb684de1c191af7bed96bc1db85ba33f6a4" },
|
||||||
"inc-rename.nvim": { "branch": "main", "commit": "8ae25b35ae16ca4bd5de3d3c472eec3b574018d4" },
|
"inc-rename.nvim": { "branch": "main", "commit": "7c79416330364976955ec8059fe3832b72ee1271" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" },
|
"lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" },
|
||||||
"lean.nvim": { "branch": "main", "commit": "f6e6ecb8f1a140315f7bfb4ea88c4a39846617b0" },
|
"lean.nvim": { "branch": "main", "commit": "22786a1c149088d5abcc3a08c3b1237d487528e0" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||||
|
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
|
||||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7f9a39fcd2ac6e979001f857727d606888f5909c" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "f760507df8c49a4bf46a4d12e1fc616797508979" },
|
||||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" },
|
"mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
"mason.nvim": { "branch": "main", "commit": "b3689a41dd77e5294498dba9757fb22cc80cbebd" },
|
||||||
"mini.ai": { "branch": "main", "commit": "dcd346a3eda9121e917950680e5eb59f59f78aae" },
|
"mini.ai": { "branch": "main", "commit": "e0d00c227112e942ed2789dd4c21d651002831c0" },
|
||||||
"mini.hipatterns": { "branch": "main", "commit": "96d07d32a0db0d8d8a10c83a964ec557cca005e7" },
|
"mini.hipatterns": { "branch": "main", "commit": "1e0e8f51d50b18eb23b50eef8d97bfd9482e29d9" },
|
||||||
"mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" },
|
"mini.icons": { "branch": "main", "commit": "e8fae66cb400744daeedf6e387347df50271c252" },
|
||||||
"mini.pairs": { "branch": "main", "commit": "3738ea30ff33e0cbf2983dc67319a5468d25b0a9" },
|
"mini.pairs": { "branch": "main", "commit": "bada72fe4ec607f882a098d15aa4a3279bc6883d" },
|
||||||
"mini.surround": { "branch": "main", "commit": "4b92d30fb5e021cced6cbb68698c73018211fbfa" },
|
"mini.surround": { "branch": "main", "commit": "aec6ed2902a2fd809e3c2fe79ee4568791285201" },
|
||||||
"neo-tree.nvim": { "branch": "main", "commit": "b2dfcc74b99f7b16a4c7cfef9dc1b38b7cf3fcda" },
|
"neo-tree.nvim": { "branch": "main", "commit": "8dd9f08ff086d09d112f1873f88dc0f74b598cdb" },
|
||||||
"neotest": { "branch": "master", "commit": "2cf3544fb55cdd428a9a1b7154aea9c9823426e8" },
|
"neotest": { "branch": "master", "commit": "2cf3544fb55cdd428a9a1b7154aea9c9823426e8" },
|
||||||
"neotest-python": { "branch": "master", "commit": "1b1b1abf928f32bbd6a7d183f7ffc80a591eb162" },
|
"neotest-python": { "branch": "master", "commit": "7cab6e2ecc260bf61b97ca147574a470bd880cbd" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-conda": { "branch": "main", "commit": "7e63124d98f48a3bb255eaa71d1602db610b9047" },
|
"nvim-conda": { "branch": "main", "commit": "7e63124d98f48a3bb255eaa71d1602db610b9047" },
|
||||||
@@ -45,27 +48,28 @@
|
|||||||
"nvim-dap-python": { "branch": "master", "commit": "bfe572e4458e0ac876b9539a1e9f301c72db8ea0" },
|
"nvim-dap-python": { "branch": "master", "commit": "bfe572e4458e0ac876b9539a1e9f301c72db8ea0" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "0864f81c681e15d9bdc1156fe3a17bd07db5a3ed" },
|
"nvim-lint": { "branch": "master", "commit": "335a6044be16d7701001059cba9baa36fbeef422" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "107c2458cdc780c4ed2c2b5e1b7800cd019010bd" },
|
"nvim-lspconfig": { "branch": "master", "commit": "a844e89ea0e0e4b207ec550c3b51fb6e471881a4" },
|
||||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "bd99d6bd2bdd346c5da090db5e3956de0e0a2f3f" },
|
"nvim-treesitter": { "branch": "main", "commit": "77362027f7aa850c87419fd571151e76b0b342a6" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931" },
|
"nvim-treesitter-textobjects": { "branch": "main", "commit": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||||
"overseer.nvim": { "branch": "master", "commit": "fe7b2f9ba263e150ab36474dfc810217b8cf7400" },
|
"overseer.nvim": { "branch": "master", "commit": "fe7b2f9ba263e150ab36474dfc810217b8cf7400" },
|
||||||
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
|
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
"render-markdown.nvim": { "branch": "main", "commit": "67f2c7c8850bb11eefa6b22054a6f4cef1146de2" },
|
"render-markdown.nvim": { "branch": "main", "commit": "9ab9dade85d8c7d411cc89b592028da3d1b7955a" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "d67a47739dfc652cfcf66c59e929c704a854b37a" },
|
"snacks.nvim": { "branch": "main", "commit": "bfc98ad198f436cbdf9fd6577ecc9066770991bc" },
|
||||||
"solarized.nvim": { "branch": "main", "commit": "c0dfe1cbfabd93b546baf5f1408f5df7e02e2050" },
|
"texpresso.vim": { "branch": "main", "commit": "d543df30b61ea886cb726a18c1d1d28ea36d30cc" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "14fd5ff7f84027064724ec3157fe903199e77ded" },
|
"tokyonight.nvim": { "branch": "main", "commit": "4d159616aee17796c2c94d2f5f87d2ee1a3f67c7" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" },
|
"trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" },
|
||||||
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
|
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
|
||||||
"typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" },
|
"typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" },
|
||||||
"venv-selector.nvim": { "branch": "main", "commit": "2b49d1f8b8fcf5cfbd0913136f48f118225cca5d" },
|
"venv-selector.nvim": { "branch": "main", "commit": "2b49d1f8b8fcf5cfbd0913136f48f118225cca5d" },
|
||||||
"vim-startuptime": { "branch": "master", "commit": "b6f0d93f6b8cf6eee0b4c94450198ba2d6a05ff6" },
|
"vim-startuptime": { "branch": "master", "commit": "b6f0d93f6b8cf6eee0b4c94450198ba2d6a05ff6" },
|
||||||
"vimtex": { "branch": "master", "commit": "77f31bd02cec678823c8614e6400db97390b5ce7" },
|
"vimtex": { "branch": "master", "commit": "2e1bbabeb2c34bb17d7bc8cfdf8f95b16dd0db0c" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
"which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" },
|
||||||
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" },
|
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" },
|
||||||
"yazi.nvim": { "branch": "main", "commit": "4e37e76f504677ac7f1ecef42d615d9ea1221608" }
|
"yazi.nvim": { "branch": "main", "commit": "922d108f2a8d83891a9c8b6da80e72677114ba4f" },
|
||||||
|
"zenbones.nvim": { "branch": "main", "commit": "a934bc07d2ed4a98b74526c172d7f043736d8935" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extras": [
|
"extras": [
|
||||||
"lazyvim.plugins.extras.ai.copilot",
|
"lazyvim.plugins.extras.ai.copilot",
|
||||||
|
"lazyvim.plugins.extras.ai.copilot-chat",
|
||||||
"lazyvim.plugins.extras.coding.blink",
|
"lazyvim.plugins.extras.coding.blink",
|
||||||
"lazyvim.plugins.extras.coding.luasnip",
|
"lazyvim.plugins.extras.coding.luasnip",
|
||||||
"lazyvim.plugins.extras.coding.mini-surround",
|
"lazyvim.plugins.extras.coding.mini-surround",
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ return {
|
|||||||
sh = "bash",
|
sh = "bash",
|
||||||
rust = "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
|
rust = "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
|
||||||
r = "cd $dir && R < $filename --no-save",
|
r = "cd $dir && R < $filename --no-save",
|
||||||
|
typst = "cd $dir && typst compile $fileName",
|
||||||
},
|
},
|
||||||
project_path = "", -- No default path defined
|
project_path = "", -- No default path defined
|
||||||
project = {},
|
project = {},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ return {
|
|||||||
{
|
{
|
||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
opts = {
|
opts = {
|
||||||
copilot_model = "claude-opus-4",
|
copilot_model = "gemini-2.5-pro",
|
||||||
suggestion = {
|
suggestion = {
|
||||||
keymap = {
|
keymap = {
|
||||||
accept = "<D-l>",
|
accept = "<D-l>",
|
||||||
|
|||||||
12
lua/plugins/default/lint.lua
Normal file
12
lua/plugins/default/lint.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
opts = {
|
||||||
|
linters = {
|
||||||
|
markdownlint_cli2 = {
|
||||||
|
args = { "--fix", "--disable", "MD013", "--" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
7
lua/plugins/discord.lua
Normal file
7
lua/plugins/discord.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"vyfor/cord.nvim",
|
||||||
|
build = ":Cord update",
|
||||||
|
-- opts = {}
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -40,4 +40,11 @@ return {
|
|||||||
"evesdropper/luasnip-latex-snippets.nvim",
|
"evesdropper/luasnip-latex-snippets.nvim",
|
||||||
enabled = false,
|
enabled = false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"let-def/texpresso.vim",
|
||||||
|
lazy = false,
|
||||||
|
keys = {
|
||||||
|
{ "<localleader>lP", "<cmd>TeXpresso %<cr>", desc = "TeXpresso" },
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
return {
|
|
||||||
-- { "mason-org/mason.nvim", version = "^1.0.0" },
|
|
||||||
-- { "mason-org/mason-lspconfig.nvim", version = "^1.0.0" },
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,32 @@
|
|||||||
return {
|
return {
|
||||||
-- Lazy
|
-- Lazy
|
||||||
|
-- {
|
||||||
|
-- "maxmx03/solarized.nvim",
|
||||||
|
-- lazy = false,
|
||||||
|
-- priority = 1000,
|
||||||
|
-- ---@type solarized.config
|
||||||
|
-- opts = {},
|
||||||
|
-- config = function(_, opts)
|
||||||
|
-- vim.o.termguicolors = true
|
||||||
|
-- vim.o.background = "light"
|
||||||
|
-- require("solarized").setup(opts)
|
||||||
|
-- vim.cmd.colorscheme("solarized")
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
{
|
{
|
||||||
"maxmx03/solarized.nvim",
|
"zenbones-theme/zenbones.nvim",
|
||||||
|
-- Optionally install Lush. Allows for more configuration or extending the colorscheme
|
||||||
|
-- If you don't want to install lush, make sure to set g:zenbones_compat = 1
|
||||||
|
-- In Vim, compat mode is turned on as Lush only works in Neovim.
|
||||||
|
dependencies = "rktjmp/lush.nvim",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
---@type solarized.config
|
-- you can set set configuration options here
|
||||||
opts = {},
|
config = function()
|
||||||
config = function(_, opts)
|
vim.g.zenbones_darken_comments = 45
|
||||||
vim.o.termguicolors = true
|
vim.cmd.colorscheme("zenbones")
|
||||||
vim.o.background = "light"
|
vim.o.background = "light"
|
||||||
require("solarized").setup(opts)
|
vim.o.termguicolors = true
|
||||||
vim.cmd.colorscheme("solarized")
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -26,7 +42,7 @@ return {
|
|||||||
{
|
{
|
||||||
"LazyVim/LazyVim",
|
"LazyVim/LazyVim",
|
||||||
opts = {
|
opts = {
|
||||||
colorscheme = "solarized",
|
colorscheme = "zenbones",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ end
|
|||||||
|
|
||||||
M.in_mathzone_tex = function()
|
M.in_mathzone_tex = function()
|
||||||
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
local node = vim.treesitter.get_node({ bufnr = 0, pos = { row - 1, col } })
|
local node = vim.treesitter.get_node({ bufnr = 0, pos = { row - 1, col - 1 } })
|
||||||
while node do
|
while node do
|
||||||
if MATH_NODES[node:type()] then
|
if MATH_NODES[node:type()] then
|
||||||
return true
|
return true
|
||||||
@@ -88,6 +88,9 @@ end
|
|||||||
M.in_item = function()
|
M.in_item = function()
|
||||||
return M.in_env("itemize") or M.in_env("enumerate")
|
return M.in_env("itemize") or M.in_env("enumerate")
|
||||||
end
|
end
|
||||||
|
M.in_item_typst = function()
|
||||||
|
return M.in_env("itemize") or M.in_env("enum")
|
||||||
|
end
|
||||||
M.in_bib = function()
|
M.in_bib = function()
|
||||||
return M.in_env("thebibliography")
|
return M.in_env("thebibliography")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user