Add LaTeX snippets and auto-session plugin configuration

This commit is contained in:
BogosBinted 2024-11-21 15:29:53 +01:00
parent 950ddeb557
commit 12401bd3fb
12 changed files with 5088 additions and 50 deletions

View File

@ -1,29 +1,31 @@
{
"LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" },
"LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" },
"auto-session": { "branch": "main", "commit": "8d2eddb14ef66ed1019c92251e2d31bb7a2a2f87" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" },
"conform.nvim": { "branch": "master", "commit": "f1125f8eace158255cf55772ce039aaf178a6b42" },
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitsigns.nvim": { "branch": "main", "commit": "9521fe8be39255b9abc6ec54e352bf04c410f5cf" },
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
"gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },
"lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
"lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" },
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "4b91f28d91979f61a3e8aef1cee5b7c7f2c7beb8" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.nvim": { "branch": "main", "commit": "7b4d5d48b6b5a75009d63f8f3e4ef4819b7e8139" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" },
"nvim-treesitter": { "branch": "master", "commit": "e1e3108cd23d7f967842261bd66126b6734d8907" },
"mini.nvim": { "branch": "main", "commit": "6714e738555b1cfbef646a23af29aa113f91f4fe" },
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
"nvim-cmp": { "branch": "main", "commit": "40a03dc225383c4f6256596c2cdf27e03b8119b5" },
"nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" },
"nvim-treesitter": { "branch": "master", "commit": "a3a732107f8b529f97bf4921b3e1af5dcc756bb6" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"tokyonight.nvim": { "branch": "main", "commit": "9758827c3b380ba89da4a2212b6255d01afbcf08" },
"tokyonight.nvim": { "branch": "main", "commit": "c2725eb6d086c8c9624456d734bd365194660017" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"vimtex": { "branch": "master", "commit": "6ee92c7ed2cdc876f499bd5561a65d04dee10d1f" },
"which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }

View File

@ -6,42 +6,31 @@ local f = ls.function_node
local fmt = require("luasnip.extras.fmt").fmt
-- Add LaTeX snippets
ls.add_snippets("tex", {
-- LaTeX Template
s("latex-template", fmt([[
\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}
{}
\end{document}
]], { i(0) })),
return { -- [[
-- Implies
s("=>", t("\\implies")),
-- Inline Math
s("mk", fmt("${}$", { i(1) })),
-- Fraction with auto-expansion for a/b pattern
s("////", fmt("\\frac{{{}}}{{{}}}", { i(1), i(2) })),
s({ trig = "(%w+)/(%w+)", regTrig = true, wordTrig = false }, {
f(function(_, snip) return "\\frac{" .. snip.captures[1] .. "}{" .. snip.captures[2] .. "}" end)
s({trig="=>", snippetType="autosnippet"},
{
t("\\implies")
}),
-- Inline Math
s({trig="mk", snippetType="autosnippet"}, fmt("${}$", { i(1) })),
-- Not Equals
s("!=", t("\\neq")),
s({trig="!=",snippetType="autosnippet"}, t("\\neq")),
-- Sum
s("sum", fmt("\\sum_{{n={}}}^{{{}}} {}", { i(1, "1"), i(2, "\\infty"), i(3, "a_n z^n") })),
s({trig="sum",snippetType="autosnippet"}, fmt("\\sum_{{n={}}}^{{{}}} {}", { i(1, "1"), i(2, "\\infty"), i(3, "a_n z^n") })),
-- Taylor Series
s("taylor", fmt("\\sum_{{{}={}}}^{{{}}} {} (x-a)^{}", { i(1, "k"), i(2, "0"), i(3, "\\infty"), i(4, "c_"), i(1) })),
s({trig="taylor",snippetType="autosnippet"}, fmt("\\sum_{{{}={}}}^{{{}}} {} (x-a)^{}", { i(1, "k"), i(2, "0"), i(3, "\\infty"), i(4, "c_"), i(1) })),
-- Limit
s("lim", fmt("\\lim_{{{} \\to {}}}", { i(1, "n"), i(2, "\\infty") })),
s({trig="lim",snippetType="autosnippet"}, fmt("\\lim_{{{} \\to {}}}", { i(1, "n"), i(2, "\\infty") })),
s({trig="xx",snippetType="autosnippet"}, t("\\times")),
--[[
-- Greek Letters
s("alpha", t("\\alpha")),
s("beta", t("\\beta")),
@ -133,10 +122,10 @@ ls.add_snippets("tex", {
-- Miscellaneous Symbols
s("del", t("\\nabla")),
s("xx", t("\\times")),
s("avg", fmt("\\langle {} \\rangle", { i(1) })),
s("norm", fmt("\\lvert {} \\rvert", { i(1) })),
s("ceil", fmt("\\lceil {} \\rceil", { i(1) })),
s("floor", fmt("\\lfloor {} \\rfloor", { i(1) }))
})
]]--
}

View File

@ -0,0 +1,189 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local fmt = require("luasnip.extras.fmt").fmt
return {
-- Tabular material
s({trig = "tab", name = "Table environment"},
{
t("\\begin{table}["), i(1,"opt"), t("]"),
t({"",""}), t("\\begin{tabular}{"), i(2,"cols"), t("}"),
t({"",""}), t(" "), i(3),
t({"",""}), t("\\end{tabular}"),
t({"",""}), t("\\end{table}")
}
),
s({trig = "rr", name = "Array environment"},
{
t("\\begin{array}{"), i(1,"cols"), t("}"),
t({"",""}), t(" "), i(2),
t({"",""}), t("\\end{array}")
}
),
s({trig = "he", name = "Break line height"},
{
t("\\\\["), i(1), t("]"),
t({"",""})
}
),
s({trig = "hyp", name = "Hyphenate text correctly"},
{
t("\\hspace{0pt}")
}
),
s({trig = "bck", name = "Redefine \\\\ last column"},
{
t("\\arraybackslash")
}
),
s({trig = "lt", name = "Align text to left"},
{
t("\\raggedleft")
}
),
s({trig = "cr", name = "Align text to center"},
{
t("\\centering")
}
),
s({trig = "rt", name = "Align text to right"},
{
t("\\raggedright")
}
),
s({trig = "hn", name = "Horizontal line"},
{
t("\\hline"),
t({"",""})
}
),
s({trig = "br", name = "Tabular row break"},
{
t("\\\\"),
t({"",""}), i(1)
}
),
-- Tabular environment preamble options
s({trig = "pc", name = "Top column"},
{
t("p{"), i(1,"width"), t("}")
}
),
s({trig = "cop", name = "num copies of opts"},
{
t("*{"), i(1,"num"), t("}{"), i(2,"opts"), t("}")
}
),
s({trig = "mc", name = "Vertically centered column"},
{
t("m{"), i(1,"width"), t("}")
}
),
s({trig = "bc", name = "Bottom column"},
{
t("b{"), i(1,"width"), t("}")
}
),
s({trig = "bl", name = "Before column options"},
{
t(">{"), i(1,"decl"), t("}")
}
),
s({trig = "af", name = "After column options"},
{
t("<{"), i(1,"decl"), t("}")
}
),
-- Floats
s({trig = "cpt", name = "Caption"},
{
c(1,
{
{
t("\\caption{"), i(1,"text"), t("}")
},
{
t("\\caption["), i(1,"list-entry"), t("]{"), i(2,"text"), t("}")
}
}
)
}
),
s({trig = "cof", name = "Caption of"},
{
c(1,
{
{
t("\\captionof{"), i(1,"type"), t("}{"), i(2,"text"), t("}")
},
{
t("\\captionof{"), i(1,"type"), t("}["), i(2,"list-entry"), t("]{"), i(3,"text"), t("}")
},
{
t("\\captionof*{"), i(1,"type"), t("}{"), i(2,"text"), t("}")
}
}
)
}
),
s({trig = "sbf", name = "Subfloat"},
{
c(1,
{
{
t("\\subfloat{"), i(1,"object"), t("}")
},
{
t("\\subfloat["), i(1,"caption"), t("]{"), i(2,"object"), t("}")
},
{
t("\\subfloat["), i(1,"list-entry"), t("]["), i(2,"caption"), t("]{"), i(3,"object"), t("}")
}
}
)
}
),
s({trig = "snt", name = "Sub-numbers for tables"},
{
t("\\begin{subtables}"),
t({"",""}), t(" "), i(1),
t({"",""}), t("\\end{subtables}")
}
),
s({trig = "snf", name = "Sub-numbers for figures"},
{
t("\\begin{subfigures}"),
t({"",""}), t(" "), i(1),
t({"",""}), t("\\end{subfigures}")
}
),
}

View File

@ -0,0 +1,244 @@
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
-- Visual placeholder
--
-- taken from https://ejmastnak.com/
local get_visual = function(args, parent, default_text)
if (#parent.snippet.env.LS_SELECT_RAW > 0) then
return sn(nil, i(1,parent.snippet.env.LS_SELECT_RAW))
else -- If LS_SELECT_RAW is empty, return a blank insert node
return sn(nil, i(1,default_text))
end
end
local function v(pos, default_text)
return d(pos, function(args, parent) return get_visual(args, parent, default_text) end)
end
return {
-- Fonts
-- Standard size-changing commands
s({trig = "tny", name = "Tiny font size"},
{
t("\\tiny")
}
),
s({trig = "scr", name = "Scriptize font size"},
{
t("\\scriptsize")
}
),
s({trig = "fot", name = "Footnote size"},
{
t("\\footnotesize")
}
),
s({trig = "sma", name = "Small font size"},
{
t("\\small")
}
),
s({trig = "nor", name = "Normalsize font"},
{
t("\\normalsize")
}
),
s({trig = "lar", name = "Large font size"},
{
c(1,
{
{
i(1,"\\large")
},
{
i(1,"\\Large")
},
{
i(1,"\\LARGE")
}
}
)
}
),
s({trig = "hug", name = "Huge font size"},
{
c(1,
{
{
i(1,"\\huge")
},
{
i(1,"\\Huge")
}
}
)
}
),
-- Standard font-changing commands and declarations
s({trig = "rm", name = "Roman family"},
{
c(1,
{
{
t("\\textrm{"), v(1,"text"), t("}")
},
{
t("\\begin{rmfamily}"), v(1,"..."), t("\\end{rmfamily}")
},
{
i(1,"\\rmfamily")
}
}
)
}
),
s({trig = "sf", name = "Sans serif family"},
{
c(1,
{
{
t("\\textsf{"), v(1,"text"), t("}")
},
{
t("\\begin{sffamily}"), v(1,"..."), t("\\end{sffamily}")
},
{
i(1,"\\sffamily")
}
}
)
}
),
s({trig = "tt", name = "Typewriter family"},
{
c(1,
{
{
t("\\texttt{"), v(1,"text"), t("}")
},
{
t("\\begin{ttfamily}"), v(1,"..."), t("\\end{ttfamily}")
},
{
i(1,"\\ttfamily")
}
}
)
}
),
s({trig = "bf", name = "Bold series"},
{
c(1,
{
{
t("\\textbf{"), v(1,"text"), t("}")
},
{
t("\\begin{bfseries}"), v(1,"..."), t("\\end{bfseries}")
},
{
i(1,"\\bfseries")
}
}
)
}
),
s({trig = "it", name = "Italic shape"},
{
c(1,
{
{
t("\\textit{"), v(1,"text"), t("}")
},
{
t("\\begin{itshape}"), v(1,"..."), t("\\end{itshape}")
},
{
i(1,"\\itshape")
}
}
)
}
),
s({trig = "sc", name = "Small caps shape"},
{
c(1,
{
{
t("\\textsc{"), v(1,"text"), t("}")
},
{
t("\\begin{scshape}"), v(1,"..."), t("\\end{scshape}")
},
{
i(1,"\\scshape")
}
}
)
}
),
s({trig = "em", name = "Emphasized text"},
{
c(1,
{
{
t("\\emph{"), v(1,"text"), t("}")
},
{
t("\\begin{em}"), v(1,"..."), t("\\end{em}")
},
{
i(1,"\\em")
}
}
)
}
),
s({trig = "tn", name = "Main font"},
{
c(1,
{
{
t("\\textnormal{"), v(1,"text"), t("}")
},
{
t("\\begin{normalfont}"), v(1,"..."), t("\\end{normalfont}")
},
{
i(1,"\\normalfont")
}
}
)
}
),
}

View File

@ -0,0 +1,491 @@
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 c = ls.choice_node
-- Visual placeholder
-- taken from https://ejmastnak.com/
local get_visual = function(args, parent, default_text)
if (#parent.snippet.env.LS_SELECT_RAW > 0) then
return sn(nil, i(1,parent.snippet.env.LS_SELECT_RAW))
else -- If LS_SELECT_RAW is empty, return a blank insert node
return sn(nil, i(1,default_text))
end
end
local function v(pos, default_text)
return d(pos, function(args, parent) return get_visual(args, parent, default_text) end)
end
return {
-- Formatting
-- Text and pages
s({trig = "url", name = "URLs"},
{
t("\\url{"), v(1,"url"), t("}")
}
),
s({trig = "ca", name = "Cancel stroke"},
{
t("\\cancel{"), v(1,"text"), t("}")
}
),
s({trig = "vrb", name = "Short verbatim"},
{
t("\\verb="), v(1,"text"), t("=")
}
),
s({trig = "ltr", name = "Enlarged letter"},
{
c(1,
{
{
t("\\lettrine{"), i(1,"initial"), t("}{"), v(2,"text"), t("}")
},
{
t("\\lettrine["), i(1,"val-list"), t("]{"), i(2,"initial"), t("}{"), v(3,"text"), t("}")
}
}
)
}
),
s({trig = "pht", name = "Phantom text"},
{
c(1,
{
{
t("\\phantom{"), v(1,"text"), t("}")
},
{
t("\\hphantom{"), v(1,"text"), t("}")
},
{
t("\\vphantom{"), v(1,"text"), t("}")
}
}
)
}
),
s({trig = "foo", name = "Footnote"},
{
t("\\footnote{"), v(1,"text"), t("}")
}
),
s({trig = "mrg", name = "Marginal note"},
{
t("\\marginpar{"), v(1,"text"), t("}")
}
),
s({trig = "npg", name = "New page"},
{
t("\\newpage")
}
),
s({trig = "pp", name = "Paragraph break"},
{
t({"",""}), t("\\bigskip"), t({"",""}), t({"",""})
}
),
s({trig = "fbo", name = "Frame box"},
{
c(1,
{
{
t("\\fbox{"),
t({"",""}), t(" "), d(1,get_visual),
t({"",""}), t("}")
},
{
t("\\fbox{"), d(1,get_visual), t("}")
}
}
)
}
),
s({trig = "fco", name = "Color frame box"},
{
c(1,
{
{
t("\\fcolorbox{"), i(1,"border-color"), t("}{"), i(2,"bg-color"), t("}{"),
t({"",""}), t(" "), d(3,get_visual),
t({"",""}), t("}")
},
{
t("\\fcolorbox{"), i(1,"border-color"), t("}{"), i(2,"bg-color"), t("}{"), d(3,get_visual), t("}")
}
}
)
}
),
s({trig = "cen", name = "Centered environment"},
{
t("\\begin{center}"),
t({"",""}), t(" "), d(1,get_visual),
t({"",""}), t("\\end{center}")
}
),
s({trig = "min", name = "Minpage environment"},
{
t("\\begin{minipage}{\\linewidth-3\\fboxsep-3\\fboxrule}"),
t({"",""}), t(" "), d(1,get_visual),
t({"",""}), t("\\end{minipage}")
}
),
s({trig = "code", name = "Code chunk"},
{
c(1,
{
{
t("{"),
t({"",""}), t("\\renewcommand\\ttdefault{cmtt}"),
t({"",""}), t(" \\begin{adjustwidth}{12mm+2mm}{2mm}"),
t({"",""}), t(" \\lstinputlisting{"), i(1), t("}"),
t({"",""}), t(" \\end{adjustwidth}"),
t({"",""}),
t({"",""}), t("}")
},
{
t("{"),
t({"",""}), t("\\renewcommand\\ttdefault{cmtt}"),
t({"",""}), t("\\begin{adjustwidth}{12mm+2mm}{2mm}"),
t({"",""}), t("\\begin{lstlisting}"),
t({"",""}), i(1),
t({"",""}), t("\\end{lstlisting}"),
t({"",""}), t("\\end{adjustwidth}"),
t({"",""}), t("}")
}
}
)
}
),
-- Columns
s({trig = "mul", name = "Multicolumns"},
{
c(1,
{
{
t("\\begin{multicols}{"), i(1,"columns"), t("}"),
t({"",""}), i(2),
t({"",""}), t("\\end{multicols}")
},
{
t("\\begin{multicols}{"), i(1,"columns"), t("}["), i(2,"preface"), t("]"),
t({"",""}), i(3),
t({"",""}), t("\\end{multicols}")
},
{
t("\\begin{multicols}{"), i(1,"columns"), t("}["), i(2,"preface"), t("]["), i(3,"skip"), t("]"),
t({"",""}), i(4),
t({"",""}), t("\\end{multicols}")
}
}
)
}
),
-- List structures
-- Ordered lists
s({trig = "rff", name = "Item reference format"},
{
t(",ref=\\the"), i(1,"<...>"), t(".\\textnormal{"), sn(2,
c(1,
{
{
i(1,"\\arabic*"), t("}")
},
{
i(1,"\\Roman*"), t("}")
},
{
i(1,"\\roman*"), t("}")
},
{
i(1,"\\Alph*"), t("}")
},
{
i(1,"\\alph*"), t("}")
}
}
)
)
}
),
s({trig = "tz", name = "Unnumbered list"},
{
t("\\begin{itemize}"),
t({"",""}), t("\\item "), i(1),
t({"",""}), t("\\end{itemize}")
}
),
s({trig = "enn", name = "Enumerated list"},
{
t("\\begin{enumerate}[label=\\textnormal{(\\arabic*)}]"),
t({"",""}), t("\\item "), i(1),
t({"",""}), t("\\end{enumerate}")
}
),
s({trig = "enI", name = "Capital roman enumerated list"},
{
t("\\begin{enumerate}[label=\\textnormal{(\\Roman*)}]"),
t({"",""}), t("\\item "), i(1),
t({"",""}), t("\\end{enumerate}")
}
),
s({trig = "eni", name = "Lowercase roman enumerated list"},
{
t("\\begin{enumerate}[label=\\textnormal{(\\roman*)}]"),
t({"",""}), t("\\item "), i(1),
t({"",""}), t("\\end{enumerate}")
}
),
s({trig = "enA", name = "Capital latin enumerated list"},
{
t("\\begin{enumerate}[label=\\textnormal{(\\Alph*)}]"),
t({"",""}), t("\\item "), i(1),
t({"",""}), t("\\end{enumerate}")
}
),
s({trig = "ena", name = "Lowercase latin enumerated list"},
{
t("\\begin{enumerate}[label=\\textnormal{(\\alph*)}]"),
t({"",""}), t("\\item "), i(1),
t({"",""}), t("\\end{enumerate}")
}
),
s({trig = "tm", name = "New item"},
{
t({"",""}),
t("\\item "), i(1)
}
),
-- Theorem-like environments
s({trig = "oo", name = "New theorem"},
{
c(1,
{
{
t("\\begin{theorem}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{theorem}")
},
{
t("\\begin{theorem}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{theorem}")
}
}
)
}
),
s({trig = "pf", name = "Proof environment"},
{
c(1,
{
{
t("\\begin{proof}"),
t({"",""}), i(1),
t({"",""}), t("\\end{proof}")
},
{
t("\\begin{proof}["), i(1,"name"), t("]"),
t({"",""}), i(2),
t({"",""}), t("\\end{proof}")
}
}
)
}
),
s({trig = "ps", name = "New proposition"},
{
c(1,
{
{
t("\\begin{proposition}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{proposition}")
},
{
t("\\begin{proposition}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{proposition}")
}
}
)
}
),
s({trig = "cc", name = "New corollary"},
{
c(1,
{
{
t("\\begin{corollary}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{corollary}")
},
{
t("\\begin{corollary}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{corollary}")
}
}
)
}
),
s({trig = "ll", name = "New lemma"},
{
c(1,
{
{
t("\\begin{lemma}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{lemma}")
},
{
t("\\begin{lemma}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{lemma}")
}
}
)
}
),
s({trig = "dd", name = "New definition"},
{
c(1,
{
{
t("\\begin{definition}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{definition}")
},
{
t("\\begin{definition}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{definition}")
}
}
)
}
),
s({trig = "re", name = "New remark"},
{
c(1,
{
{
t("\\begin{remark}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{remark}")
},
{
t("\\begin{remark}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{remark}")
}
}
)
}
),
s({trig = "ex", name = "New exercise"},
{
c(1,
{
{
t("\\begin{exercise}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{exercise}")
},
{
t("\\begin{exercise}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{exercise}")
}
}
)
}
),
s({trig = "ee", name = "New example"},
{
c(1,
{
{
t("\\begin{example}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{example}")
},
{
t("\\begin{example}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{example}")
}
}
)
}
),
s({trig = "pn", name = "New principle"},
{
c(1,
{
{
t("\\begin{principle}"),
t({"",""}), d(1,get_visual),
t({"",""}), t("\\end{principle}")
},
{
t("\\begin{principle}["), i(1,"name"), t("]"),
t({"",""}), d(2,get_visual),
t({"",""}), t("\\end{principle}")
}
}
)
}
),
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,95 @@
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
return {
s({ trig = "BigProd",snippetType="autosnippet" },
fmta('\\prod_{<>}^{<>} <>', {
i(1, "n=1"),
i(2, "\\infty"),
i(0),}
)),
s(
{ trig = "__", snippetType="autosnippet" },
fmta("_{<>}", { i(1) })
),
s({ trig = "!=", snippetType = "autosnippet" }, {t("\\neq")}),
s({ trig = "==", snippetType = "autosnippet" }, {t("&= \\\\")}),
s({ trig = "~=", snippetType = "autosnippet" }, {t("\\approx ")}),
s({ trig = "~~", snippetType = "autosnippet" }, {t("\\sim ")}),
s({ trig = "->", snippetType = "autosnippet" }, {t("\\to ")}),
s({ trig = "<->", snippetType = "autosnippet" }, {t("\\leftrightarrow")}),
s({ trig = "!>", snippetType = "autosnippet" }, {t("\\mapsto ")}),
s({ trig = ">>", snippetType = "autosnippet" }, {t("\\gg")}),
s({ trig = "<<", snippetType = "autosnippet" }, {t("\\ll")}),
s({ trig = "cc", snippetType = "autosnippet" }, {t("\\subset ")}),
s({ trig = "notin", snippetType = "autosnippet" }, {t("\\not\\in ")}),
s({ trig = "inn", snippetType = "autosnippet" }, {t("\\in ")}),
s({ trig = "Nn", snippetType = "autosnippet" }, {t("\\cap ")}),
s({ trig = "UU", snippetType = "autosnippet" }, {t("\\cup ")}),
--- Debugging additional snippets
s(
{ trig = "uuu", snippetType = "autosnippet" },
fmta("\\bigcup_{<> \\in <>} <>", {
i(1, "i"),
i(2, "I"),
i(0),
})
),
s({trig="rond", snippetType="autosnippet"},
{
t("\\circ"),
}),
s({trig="Brond", snippetType="autosnippet"},
{
t("\\bigcircs"),
}),
s(
{ trig = "Pscal", snippetType = "autosnippet" },
fmta("\\bigcup_{<> \\in <>} <>", {
i(1, "i"),
i(2, "I"),
i(0),
})
),
s({trig="nabl", snippetType="autosnippet"},
{
t("\\nabla"),
}),
s({trig="partial", snippetType="autosnippet"},
{
t("\\partial"),
}),
s({trig=";comp", snippetType="autosnippet"},
{
t("^{c}")
}),
s({trig="//",snippetType="autosnippet"},
fmta("\\frac{<>}{<>}<>", {
i(1,"a"),
i(2,"b"),
i(0," ")
})),
}

View File

@ -0,0 +1,934 @@
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_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 r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
local k = require("luasnip.nodes.key_indexer").new_key
-- Visual placeholder
-- taken from https://ejmastnak.com/
local get_visual = function(args, parent, default_text)
if (#parent.snippet.env.LS_SELECT_RAW > 0) then
return sn(nil, i(1,parent.snippet.env.LS_SELECT_RAW))
else -- If LS_SELECT_RAW is empty, return a blank insert node
return sn(nil, i(1,default_text))
end
end
local function v(pos, default_text)
return d(pos, function(args, parent) return get_visual(args, parent, default_text) end)
end
return {
-- Document preamble
s({trig = "doc", name = "Document class"},
{
c(1,
{
{
t("\\documentclass{"), i(1,"document-class"), t("}")
},
{
t("\\documentclass["), i(1,"class-options"), t("]{"), i(2,"document-class"), t("}")
}
}
)
}
),
s({trig = "pk", name = "Use package"},
{
c(1,
{
{
t("\\usepackage{"), i(1,"package-name"), t("}")
},
{
t("\\usepackage["), i(1,"package-options"), t("]{"), i(2,"package-name"), t("}")
}
}
)
}
),
s({trig = "tl", name = "Title"},
{
t("\\title{"), i(1,"..."), t("}")
}
),
s({trig = "dat", name = "Date"},
{
t("\\date{"), i(1,"..."), t("}")
}
),
s({trig = "aut", name = "Author"},
{
t("\\author{"), i(1,"..."), t("}")
}
),
s({trig = "td", name = "Today's date"},
{
t("\\today")
}
),
s({trig = "bd", name = "Begin document"},
{
t("\\begin{document}"),
t({"",""}),
t({"",""}), i(1),
t({"",""}),
t({"",""}), t("\\end{document}")
}
),
-- Sectioning
s({trig = "scn", name = "Section"},
{
c(1,
{
{
t("\\section{"), v(1,"title"), t("}")
},
{
t("\\section*{"), v(1,"title"), t("}")
},
{
t("\\section["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "sbn", name = "Subection"},
{
c(1,
{
{
t("\\subsection{"), v(1,"title"), t("}")
},
{
t("\\subsection*{"), v(1,"title"), t("}")
},
{
t("\\subsection["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "ssn", name = "Subsubection"},
{
c(1,
{
{
t("\\subsubsection{"), v(1,"title"), t("}")
},
{
t("\\subsubsection*{"), v(1,"title"), t("}")
},
{
t("\\subsubsection["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "chr", name = "Chapter"},
{
c(1,
{
{
t("\\chapter{"), v(1,"title"), t("}")
},
{
t("\\chapter*{"), v(1,"title"), t("}")
},
{
t("\\chapter["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "prt", name = "Part"},
{
c(1,
{
{
t("\\part{"), i(1,"title"), t("}")
},
{
t("\\part*{"), i(1,"title"), t("}")
},
{
t("\\part["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "pr", name = "Paragraph"},
{
c(1,
{
{
t("\\paragraph{"), i(1,"title"), t("}")
},
{
t("\\paragraph*{"), i(1,"title"), t("}")
},
{
t("\\paragraph["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "sbp", name = "Subaragraph"},
{
c(1,
{
{
t("\\subparagraph{"), i(1,"title"), t("}")
},
{
t("\\subparagraph*{"), i(1,"title"), t("}")
},
{
t("\\subparagraph["), i(1,"toc-entry"), t("]{"), v(2,"title"), t("}")
}
}
)
}
),
s({trig = "phs", name = "Hyperref jump to correct page"},
{
t("\\phantomsection")
}
),
s({trig = "add", name = "Add entry to list"},
{
t("\\addcontentsline{"), i(1,"file"), t("}{"), i(2,"sec-unit"), t("}{"), i(3,"list-entry"), t("}")
}
),
s({trig = "mkb", name = "Headers in twoside mode"},
{
t("\\markboth{"), i(1,"left"), t("}{"), i(2,"right"), t("}")
}
),
s({trig = "mkt", name = "Maketitle"},
{
t("\\maketitle")
}
),
s({trig = "toc", name = "Table of contents"},
{
t("\\tableofcontents")
}
),
s({trig = "lot", name = "List of tables"},
{
t("\\listoftables")
}
),
s({trig = "lof", name = "List of figures"},
{
t("\\listoffigures")
}
),
s({trig = "mki", name = "Makeindex"},
{
t("\\makeindex")
}
),
s({trig = "pix", name = "Print index"},
{
t("\\printindex")
}
),
s({trig = "pdf", name = "PDF bookmark"},
{
t("\\texorpdfstring{"), v(1,"tex"), t("}{"), i(2,"bookmark"), t("}")
}
),
s({trig = "lec", name = "Lecture section"},
{
t("%%% "), v(1,"title"),
t({"",""}), t("\\seclecture{"), rep(1), t("}{"), i(2,"date"), t("}")
}
),
s({trig = "les", name = "Lecture subsection"},
{
t("%%% "), v(1,"title"),
t({"",""}), t("\\sublecture{"), rep(1), t("}{"), i(2,"date"), t("}")
}
),
s({trig = "date", name = "Print current date"},
{
f(function() return os.date("%a %d %b %y") end)
}
),
s({trig = "tim", name = "Margin paragraph timestamp"},
{
t("\\marginpar{\\footnotesize\\textsf{\\mbox{"), i(1,"date"), t("}}}")
}
),
-- Cross-references
-- Labels
s({trig = "lge", name = "Generic label"},
{
t("\\label{"), i(1,"key"), t("}")
}
),
s({trig = "lsn", name = "Label section"},
{
t("\\label{sec:"), i(1,"key"), t("}")
}
),
s({trig = "lsb", name = "Label subsection"},
{
t("\\label{sub:"), i(1,"key"), t("}")
}
),
s({trig = "lss", name = "Label subsubsection"},
{
t("\\label{ssub:"), i(1,"key"), t("}")
}
),
s({trig = "lch", name = "Label chapter"},
{
t("\\label{ch:"), i(1,"key"), t("}")
}
),
s({trig = "lpa", name = "Label paragraph"},
{
t("\\label{par:"), i(1,"key"), t("}")
}
),
s({trig = "lsp", name = "Label subparagraph"},
{
t("\\label{subpar:"), i(1,"key"), t("}")
}
),
s({trig = "lbe", name = "Label equation"},
{
t("\\label{eq:"), i(1,"key"), t("}")
}
),
s({trig = "lbt", name = "Label theorem"},
{
t("\\label{thm:"), i(1,"key"), t("}")
}
),
s({trig = "lps", name = "Label proposition"},
{
t("\\label{prop:"), i(1,"key"), t("}")
}
),
s({trig = "lle", name = "Label lemma"},
{
t("\\label{lem:"), i(1,"key"), t("}")
}
),
s({trig = "lco", name = "Label corollary"},
{
t("\\label{cor:"), i(1,"key"), t("}")
}
),
s({trig = "lde", name = "Label definition"},
{
t("\\label{def:"), i(1,"key"), t("}")
}
),
s({trig = "lre", name = "Label remark"},
{
t("\\label{rem:"), i(1,"key"), t("}")
}
),
s({trig = "lex", name = "Label exercise"},
{
t("\\label{ex:"), i(1,"key"), t("}")
}
),
s({trig = "leg", name = "Label example"},
{
t("\\label{eg:"), i(1,"key"), t("}")
}
),
s({trig = "lpn", name = "Label principle"},
{
t("\\label{princ:"), i(1,"key"), t("}")
}
),
s({trig = "lbi", name = "Label item"},
{
t("\\label{it:"), i(1,"key"), t("}")
}
),
s({trig = "lfg", name = "Label figure"},
{
t("\\label{fig:"), i(1,"key"), t("}")
}
),
s({trig = "lta", name = "Label table"},
{
t("\\label{tbl:"), i(1,"key"), t("}")
}
),
-- Reference commands
s({trig = "rge", name = "Generic cross-reference"},
{
c(1,
{
{
t("\\ref{"), i(1,"key"), t("}")
},
{
t("\\cref{"), i(1,"key"), t("}")
},
{
t("\\Cref{"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rsn", name = "Reference section"},
{
c(1,
{
{
t("\\ref{sec:"), i(1,"key"), t("}")
},
{
t("\\cref{sec:"), i(1,"key"), t("}")
},
{
t("\\Cref{sec:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rsb", name = "Reference subsection"},
{
c(1,
{
{
t("\\ref{sub:"), i(1,"key"), t("}")
},
{
t("\\cref{sub:"), i(1,"key"), t("}")
},
{
t("\\Cref{sub:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rss", name = "Reference subsubsection"},
{
c(1,
{
{
t("\\ref{ssub:"), i(1,"key"), t("}")
},
{
t("\\cref{ssub:"), i(1,"key"), t("}")
},
{
t("\\Cref{ssub:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rch", name = "Reference chapter"},
{
c(1,
{
{
t("\\ref{ch:"), i(1,"key"), t("}")
},
{
t("\\cref{ch:"), i(1,"key"), t("}")
},
{
t("\\Cref{ch:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rpa", name = "Reference paragraph"},
{
c(1,
{
{
t("\\ref{par:"), i(1,"key"), t("}")
},
{
t("\\cref{par:"), i(1,"key"), t("}")
},
{
t("\\Cref{par:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rsp", name = "Reference subparagraph"},
{
c(1,
{
{
t("\\ref{subpar:"), i(1,"key"), t("}")
},
{
t("\\cref{subpar:"), i(1,"key"), t("}")
},
{
t("\\Cref{subpar:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rfe", name = "Reference equation"},
{
c(1,
{
{
t("\\eqref{eq:"), i(1,"key"), t("}")
},
{
t("\\cref{eq:"), i(1,"key"), t("}")
},
{
t("\\Cref{eq:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rft", name = "Reference theorem"},
{
c(1,
{
{
t("\\ref{thm:"), i(1,"key"), t("}")
},
{
t("\\cref{thm:"), i(1,"key"), t("}")
},
{
t("\\Cref{thm:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rps", name = "Reference proposition"},
{
c(1,
{
{
t("\\ref{prop:"), i(1,"key"), t("}")
},
{
t("\\cref{prop:"), i(1,"key"), t("}")
},
{
t("\\Cref{prop:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rle", name = "Reference lemma"},
{
c(1,
{
{
t("\\ref{lem:"), i(1,"key"), t("}")
},
{
t("\\cref{lem:"), i(1,"key"), t("}")
},
{
t("\\Cref{lem:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rco", name = "Reference corollary"},
{
c(1,
{
{
t("\\ref{cor:"), i(1,"key"), t("}")
},
{
t("\\cref{cor:"), i(1,"key"), t("}")
},
{
t("\\Cref{cor:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rde", name = "Reference definition"},
{
c(1,
{
{
t("\\ref{def:"), i(1,"key"), t("}")
},
{
t("\\cref{def:"), i(1,"key"), t("}")
},
{
t("\\Cref{def:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rre", name = "Reference remark"},
{
c(1,
{
{
t("\\ref{rem:"), i(1,"key"), t("}")
},
{
t("\\cref{rem:"), i(1,"key"), t("}")
},
{
t("\\Cref{rem:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rex", name = "Reference exercise"},
{
c(1,
{
{
t("\\ref{ex:"), i(1,"key"), t("}")
},
{
t("\\cref{ex:"), i(1,"key"), t("}")
},
{
t("\\Cref{ex:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "reg", name = "Reference example"},
{
c(1,
{
{
t("\\ref{eg:"), i(1,"key"), t("}")
},
{
t("\\cref{eg:"), i(1,"key"), t("}")
},
{
t("\\Cref{eg:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rpn", name = "Reference principle"},
{
c(1,
{
{
t("\\ref{princ:"), i(1,"key"), t("}")
},
{
t("\\cref{princ:"), i(1,"key"), t("}")
},
{
t("\\Cref{princ:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rfi", name = "Reference item"},
{
c(1,
{
{
t("\\ref{it:"), i(1,"key"), t("}")
},
{
t("\\cref{it:"), i(1,"key"), t("}")
},
{
t("\\Cref{it:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rfg", name = "Reference figure"},
{
c(1,
{
{
t("\\ref{fig:"), i(1,"key"), t("}")
},
{
t("\\cref{fig:"), i(1,"key"), t("}")
},
{
t("\\Cref{fig:"), i(1,"key"), t("}")
}
}
)
}
),
s({trig = "rta", name = "Reference table"},
{
c(1,
{
{
t("\\ref{tbl:"), i(1,"key"), t("}")
},
{
t("\\cref{tbl:"), i(1,"key"), t("}")
},
{
t("\\Cref{tbl:"), i(1,"key"), t("}")
}
}
)
}
),
-- Page reference commands
s({trig = "pge", name = "Generic page reference"},
{
t("\\pageref{"), i(1,"key"), t("}")
}
),
s({trig = "psn", name = "Page of section"},
{
t("\\pageref{sec:"), i(1,"key"), t("}")
}
),
s({trig = "psb", name = "Page of subsection"},
{
t("\\pageref{sub:"), i(1,"key"), t("}")
}
),
s({trig = "pss", name = "Page of subsubsection"},
{
t("\\pageref{ssub:"), i(1,"key"), t("}")
}
),
s({trig = "pch", name = "Page of chapter"},
{
t("\\pageref{ch:"), i(1,"key"), t("}")
}
),
s({trig = "ppa", name = "Page of paragraph"},
{
t("\\pageref{par:"), i(1,"key"), t("}")
}
),
s({trig = "psp", name = "Page of subparagraph"},
{
t("\\pageref{subpar:"), i(1,"key"), t("}")
}
),
s({trig = "peq", name = "Page of equation"},
{
t("\\eqref{eq:"), i(1,"key"), t("}")
}
),
s({trig = "pgt", name = "Page of theorem"},
{
t("\\pageref{thm:"), i(1,"key"), t("}")
}
),
s({trig = "pps", name = "Page of proposition"},
{
t("\\pageref{prop:"), i(1,"key"), t("}")
}
),
s({trig = "ple", name = "Page of lemma"},
{
t("\\pageref{lem:"), i(1,"key"), t("}")
}
),
s({trig = "pco", name = "Page of corollary"},
{
t("\\pageref{cor:"), i(1,"key"), t("}")
}
),
s({trig = "pde", name = "Page of definition"},
{
t("\\pageref{def:"), i(1,"key"), t("}")
}
),
s({trig = "pre", name = "Page of remark"},
{
t("\\pageref{rem:"), i(1,"key"), t("}")
}
),
s({trig = "pex", name = "Page of exercise"},
{
t("\\pageref{ex:"), i(1,"key"), t("}")
}
),
s({trig = "peg", name = "Page of example"},
{
t("\\pageref{eg:"), i(1,"key"), t("}")
}
),
s({trig = "ppn", name = "Page of principle"},
{
t("\\pageref{princ:"), i(1,"key"), t("}")
}
),
s({trig = "pgi", name = "Page of item"},
{
t("\\pageref{it:"), i(1,"key"), t("}")
}
),
s({trig = "pfg", name = "Page of figure"},
{
t("\\pageref{fig:"), i(1,"key"), t("}")
}
),
s({trig = "pta", name = "Page of table"},
{
t("\\pageref{tbl:"), i(1,"key"), t("}")
}
),
}

View File

@ -22,10 +22,12 @@ return {
t("\\pm"),
}
),
--[[
s({trig="pm", snippetType="autosnippet"},
{
t("\\pm"),
}),
]]--
s({trig="-+", snippetType="autosnippet"},
{
t("\\mp"),
@ -82,6 +84,12 @@ return {
{
t("\\exists"),
}),
s({trig="ortho", snippetType="autosnippet"},
{
t("\\perp"),
}),
-- Set notation
@ -129,13 +137,81 @@ return {
{
t("\\mathbb{C}"),
}),
-- Delimiters
s({trig="norm", snippetType="autosnippet"},
fmt("\\lvert {} \\rvert",{ i(1) })
),
s({trig="pentiere", snippetType="autosnippet"},
fmt("\\lfloor {} \\rfloor",{ i(1) })
),
}
s({trig="norm", snippetType="autosnippet"},
fmta("\\lvert <> \\rvert <>",{ i(1,"u"), i(0) })),
s({trig="pentiere", snippetType="autosnippet"},
fmta("\\lfloor <> \\floor <>",{ i(1, "n"), i(0) })),
s({trig="mcal", snippetType="autosnippet"},
fmta("\\mathcal{<>} <>",{ i(1, "I"), i(0) })),
s({trig="mbb", snippetType="autosnippet"},
fmta("\\mathbb{<>} <>",{ i(1, "I"), i(0) })),
s({trig="norm", snippetType="autosnippet"},
{fmt("\\lvert {} \\rvert",{ i(1) })
}),
s({trig="pentiere", snippetType="autosnippet"},
fmt("\\lfloor {} \\rfloor",{ i(1) })),
s({ trig = 'mcal', snippetType="autosnippet" },
{fmta('\\mathcal{<>}<>', {
i(1),
i(0),})
}),
s({ trig = 'mbb', snippetType="autosnippet" },
{fmta('\\mathbb{<>}<>', {
i(1),
i(0),})
}),
s({trig="etoile", snippetType="autosnippet"},
{
t("\\ast"),
}),
s({trig="xnn", snippetType="autosnippet"},
{
t("x_{n}"),
}),
-- Common Variable Notations
s({ trig = 'ynn', snippetType="autosnippet" }, {t('y_{n}')}),
s({ trig = 'xii', snippetType="autosnippet" }, {t('x_{i}')}),
s({ trig = 'yii', snippetType="autosnippet" }, {t('y_{i}')} ),
s({ trig = 'xjj', snippetType="autosnippet" }, {t('x_{j}')} ),
s({ trig = 'yjj', snippetType="autosnippet" }, {t('y_{j}')} ),
s({ trig = 'xp1', snippetType="autosnippet" }, {t('x_{n+1}')} ),
s({ trig = 'xmm', snippetType="autosnippet" }, {t('x_{m}')} ),
s({ trig = ';adh', snippetType="autosnippet" },
fmta('\\overset{\\circ}{<>}<>', {
i(1),
i(0),})
),
s({ trig = ';int', snippetType="autosnippet" },
fmta('\\overline{<>}<>', {
i(1),
i(0),})
),
}

View File

@ -0,0 +1,61 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local fmta = require("luasnip.extras.fmt").fmta
-- Template pour un document LaTeX
return {
s({trig="textemplate",snippetType="autosnippet"}, fmta([[
\documentclass[a4paper]{article}
% Packages pour les mathématiques et la langue française
\usepackage{amsmath, amssymb, amsfonts, amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\setlength{\parindent}{0pt} % Pas d'indentation en début de paragraphe
% Définitions des environnements pour les théorèmes, définitions, etc.
\newtheorem{definition}{Définition}
\newtheorem{proposition}{Proposition}
\title{<>}
\author{<>}
\date{\today}
\begin{document}
\maketitle % Génère le titre
\tableofcontents % Génère la table des matières
\section{<>}
\begin{definition}[<>]
\vspace{5pt}
<>
\end{definition}
\begin{proposition}
\vspace{5pt}
<>
\end{proposition}
\begin{proof}
\vspace{5pt}
<>
\end{proof}
\end{document}
]], {
i(1, "Titre du document"), -- Titre du document
i(2, "Ton Nom"), -- Auteur
i(3, "Titre de la section"), -- Titre de la première section
i(4, "Nom de la définition"), -- Nom de la définition
i(5, "Contenu de la définition"), -- Contenu de la définition
i(6, "Contenu de la proposition"), -- Contenu de la proposition
i(7, "Contenu de la preuve"), -- Contenu de la preuve
})),
}

View File

@ -0,0 +1,6 @@
return {
"rmagatti/auto-session",
config = function()
require("auto-session").setup()
end,
}

View File

@ -10,8 +10,21 @@ return {{
-- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_method = "zathura"
end
},
--[[ {
},
{"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && yarn install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
}
--[[
"iurimateus/luasnip-latex-snippets.nvim",
config = function()
require'luasnip-latex-snippets'.setup({use_treesitter=false})