aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua20
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/at.lua28
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/nix/delimiter.lua24
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua5
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/environments.lua130
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/fonts.lua110
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/math.lua537
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/new.lua51
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/static.lua94
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/system.lua168
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/tmp.lua24
11 files changed, 13 insertions, 1178 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua
index 2fecd1e7..5bb389f0 100644
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua
@@ -1,9 +1,9 @@
local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
+ if (#parent.snippet.env.SELECT_RAW > 0) then
+ return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
+ else
+ return sn(nil, i(1, ''))
+ end
end
local function char_count_same(c1, c2)
local line = vim.api.nvim_get_current_line()
@@ -40,12 +40,18 @@ local function pair(pair_begin, pair_end, expand_func, ...)
})
end
+local maybe;
+if vim.bo.filetype == "tex" then
+ maybe.pair = {
+ pair("<", ">", neg, char_count_same),
+ }
+end
+
return {
pair("(", ")", neg, char_count_same),
pair("{", "}", neg, char_count_same),
pair("[", "]", neg, char_count_same),
- -- pair("<", ">", neg, char_count_same),
pair("'", "'", neg, even_count),
pair('"', '"', neg, even_count),
pair("`", "`", neg, even_count),
-}
+} + maybe.pair
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/at.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/at.lua
deleted file mode 100644
index 8f84fd30..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/at.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1))
- end
-end
-
-local line_begin = require("luasnip.extras.expand_conditions").line_begin
-
-return {
- -- HEADER
- s({ trig = "tr", regTrig = false, wordTrig = true, snippetType = "autosnippet" },
- fmt(
- [[
- <tr>
- <td><code>{}</code></td>
- <th><code>{}</code></th>
- </tr>
- ]] ,
- {
- d(1, get_visual),
- d(2, get_visual),
- }
- ),
- { condition = line_begin }
- ),
-}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/nix/delimiter.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/nix/delimiter.lua
deleted file mode 100644
index 12e1df42..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/nix/delimiter.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
-end
-
-
--- Return snippet tables
-return
-{
- -- LEFT/RIGHT ALL BRACES
- s({trig = "cmd;(.*);", regTrig = true, wordTrig = false, snippetType="autosnippet"},
- fmta(
- [[<> = builtins.readFile "./cmds/<>.sh";]],
- {
- f( function(_, snip) return snip.captures[1] end ),
- f( function(_, snip) return snip.captures[1] end ),
- }
- )
- ),
-}
-
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua
index 36cae366..2e11d43d 100644
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua
@@ -12,11 +12,6 @@ local translation_table = {
["["] = "]",
}
--- Math context detection
-local tex = {}
-tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
-tex.in_text = function() return not tex.in_mathzone() end
-
-- Return snippet tables
return
{
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/environments.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/environments.lua
deleted file mode 100644
index e88bc16e..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/environments.lua
+++ /dev/null
@@ -1,130 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(0, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(0, ''))
- end
-end
-
--- Math context detection
-local tex = {}
-tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
-tex.in_text = function() return not tex.in_mathzone() end
-
-local line_begin = require("luasnip.extras.expand_conditions").line_begin
-
--- Return snippet tables
-return {
- -- EQUATION
--- s({ trig = "nn", snippetType = "autosnippet" },
--- fmta(
--- [[
--- \begin{equation*}
--- <>
--- \end{equation*}
--- ]] ,
--- {
--- i(0),
--- }
--- ),
--- { condition = line_begin }
--- ),
--- -- SPLIT EQUATION
--- s({ trig = "ss", snippetType = "autosnippet" },
--- fmta(
--- [[
--- \begin{equation*}
--- \begin{split}
--- <>
--- \end{split}
--- \end{equation*}
--- ]] ,
--- {
--- d(1, get_visual),
--- }
--- ),
--- { condition = line_begin }
--- ),
--- -- ALIGN
--- s({ trig = "all", snippetType = "autosnippet" },
--- fmta(
--- [[
--- \begin{align*}
--- <>
--- \end{align*}
--- ]] ,
--- {
--- i(0),
--- }
--- ),
--- { condition = line_begin }
--- ),
--- -- ITEMIZE
--- s({ trig = "itt", snippetType = "autosnippet" },
--- fmta(
--- [[
--- \begin{itemize}
---
--- \item <>
---
--- \end{itemize}
--- ]] ,
--- {
--- i(0),
--- }
--- ),
--- { condition = line_begin }
--- ),
--- -- ENUMERATE
--- s({ trig = "enn", snippetType = "autosnippet" },
--- fmta(
--- [[
--- \begin{enumerate}
---
--- \item <>
---
--- \end{enumerate}
--- ]] ,
--- {
--- i(0),
--- }
--- )
--- ),
--- -- INLINE MATH
--- s({ trig = "([^%l])mm", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
--- fmta(
--- "<>$<>$",
--- {
--- f(function(_, snip) return snip.captures[1] end),
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- INLINE MATH ON NEW LINE
--- s({ trig = "^mm", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
--- fmta(
--- "$<>$",
--- {
--- i(0),
--- })),
--- -- FIGURE
--- s({ trig = "fig" },
--- fmta(
--- [[
--- \begin{figure}[htb!]
--- \centering
--- \includegraphics[width=<>\linewidth]{<>}
--- \caption{<>}
--- \label{fig:<>}
--- \end{figure}
--- ]] ,
--- {
--- i(1),
--- i(2),
--- i(3),
--- i(4),
--- }
--- ),
--- { condition = line_begin }
--- ),
-}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/fonts.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/fonts.lua
deleted file mode 100644
index aeddf571..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/fonts.lua
+++ /dev/null
@@ -1,110 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
-end
-
--- A logical OR of `line_begin` and the regTrig '[^%a]trig'
-function line_begin_or_non_letter(line_to_cursor, matched_trigger)
- local line_begin = line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$")
- local non_letter = line_to_cursor:sub(-(#matched_trigger + 1), -(#matched_trigger + 1)):match("[^%a]")
- return line_begin or non_letter
-end
-
--- Math context detection
-local tex = {}
-tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
-tex.in_text = function() return not tex.in_mathzone() end
-
-local line_begin = function(line_to_cursor, matched_trigger)
- -- +1 because `string.sub("abcd", 1, -2)` -> abc
- return line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$")
-end
-
--- Return snippet tables
-return
- {
--- -- TYPEWRITER i.e. \texttt
--- s({trig = "([^%a])sd", regTrig = true, wordTrig = false, snippetType="autosnippet", priority=2000},
--- fmta(
--- "<>\\texttt{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_text}
--- ),
--- -- ITALIC i.e. \textit
--- s({trig = "([^%a])tii", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\textit{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- BOLD i.e. \textbf
--- s({trig = "tbb", snippetType="autosnippet"},
--- fmta(
--- "\\textbf{<>}",
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- MATH ROMAN i.e. \mathrm
--- s({trig = "([^%a])rmm", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\mathrm{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- MATH CALIGRAPHY i.e. \mathcal
--- s({trig = "([^%a])mcc", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\mathcal{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- MATH BOLDFACE i.e. \mathbf
--- s({trig = "([^%a])mbf", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\mathbf{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- MATH BLACKBOARD i.e. \mathbb
--- s({trig = "([^%a])mbb", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\mathbb{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- REGULAR TEXT i.e. \text (in math environments)
--- s({trig = "([^%a])tee", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\text{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- { condition = tex.in_mathzone }
--- ),
- }
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/math.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/math.lua
deleted file mode 100644
index e252ad43..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/math.lua
+++ /dev/null
@@ -1,537 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(0, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(0, ''))
- end
-end
-
--- Math context detection
-local tex = {}
-tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
-tex.in_text = function() return not tex.in_mathzone() end
-
--- Return snippet tables
-return
-{
--- -- SUPERSCRIPT
--- s({trig = "([%w%)%]%}])'", wordTrig=false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SUBSCRIPT
--- s({trig = "([%w%)%]%}]);", wordTrig=false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SUBSCRIPT AND SUPERSCRIPT
--- s({trig = "([%w%)%]%}])__", wordTrig=false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>^{<>}_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- TEXT SUBSCRIPT
--- s({trig = 'sd', snippetType="autosnippet", wordTrig=false},
--- fmta("_{\\mathrm{<>}}",
--- { d(1, get_visual) }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SUPERSCRIPT SHORTCUT
--- -- Places the first alphanumeric character after the trigger into a superscript.
--- s({trig = '([%w%)%]%}])"([%w])', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- f( function(_, snip) return snip.captures[2] end ),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SUBSCRIPT SHORTCUT
--- -- Places the first alphanumeric character after the trigger into a subscript.
--- s({trig = '([%w%)%]%}]):([%w])', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- f( function(_, snip) return snip.captures[2] end ),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- EULER'S NUMBER SUPERSCRIPT SHORTCUT
--- s({trig = '([^%a])ee', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>e^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual)
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- ZERO SUBSCRIPT SHORTCUT
--- s({trig = '([%a%)%]%}])00', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- t("0")
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- MINUS ONE SUPERSCRIPT SHORTCUT
--- s({trig = '([%a%)%]%}])11', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- t("-1")
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- J SUBSCRIPT SHORTCUT (since jk triggers snippet jump forward)
--- s({trig = '([%a%)%]%}])JJ', wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- t("j")
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- PLUS SUPERSCRIPT SHORTCUT
--- s({trig = '([%a%)%]%}])%+%+', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- t("+")
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- COMPLEMENT SUPERSCRIPT
--- s({trig = '([%a%)%]%}])CC', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- t("\\complement")
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- CONJUGATE (STAR) SUPERSCRIPT SHORTCUT
--- s({trig = '([%a%)%]%}])%*%*', regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- t("*")
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- VECTOR, i.e. \vec
--- s({trig = "([^%a])vv", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\vec{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- DEFAULT UNIT VECTOR WITH SUBSCRIPT, i.e. \unitvector_{}
--- s({trig = "([^%a])ue", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\unitvector_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- UNIT VECTOR WITH HAT, i.e. \uvec{}
--- s({trig = "([^%a])uv", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\uvec{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- MATRIX, i.e. \vec
--- s({trig = "([^%a])mt", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\mat{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- FRACTION
--- s({trig = "([^%a])ff", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\frac{<>}{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- i(2),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- ANGLE
--- s({trig = "([^%a])gg", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\ang{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- ABSOLUTE VALUE
--- s({trig = "([^%a])aa", regTrig = true, wordTrig = false, snippetType="autosnippet"},
--- fmta(
--- "<>\\abs{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SQUARE ROOT
--- s({trig = "([^%\\])sq", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\sqrt{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- BINOMIAL SYMBOL
--- s({trig = "([^%\\])bnn", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\binom{<>}{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- LOGARITHM WITH BASE SUBSCRIPT
--- s({trig = "([^%a%\\])ll", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\log_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- DERIVATIVE with denominator only
--- s({trig = "([^%a])dV", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\dvOne{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- DERIVATIVE with numerator and denominator
--- s({trig = "([^%a])dvv", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\dv{<>}{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2)
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- DERIVATIVE with numerator, denominator, and higher-order argument
--- s({trig = "([^%a])ddv", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\dvN{<>}{<>}{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2),
--- i(3),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- PARTIAL DERIVATIVE with denominator only
--- s({trig = "([^%a])pV", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\pdvOne{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- PARTIAL DERIVATIVE with numerator and denominator
--- s({trig = "([^%a])pvv", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\pdv{<>}{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2)
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- PARTIAL DERIVATIVE with numerator, denominator, and higher-order argument
--- s({trig = "([^%a])ppv", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\pdvN{<>}{<>}{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2),
--- i(3),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SUM with lower limit
--- s({trig = "([^%a])sM", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\sum_{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- SUM with upper and lower limit
--- s({trig = "([^%a])smm", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\sum_{<>}^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- INTEGRAL with upper and lower limit
--- s({trig = "([^%a])intt", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\int_{<>}^{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- i(1),
--- i(2),
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- -- BOXED command
--- s({trig = "([^%a])bb", wordTrig = false, regTrig = true, snippetType="autosnippet"},
--- fmta(
--- "<>\\boxed{<>}",
--- {
--- f( function(_, snip) return snip.captures[1] end ),
--- d(1, get_visual)
--- }
--- ),
--- {condition = tex.in_mathzone}
--- ),
--- --
--- -- BEGIN STATIC SNIPPETS
--- --
---
--- -- DIFFERENTIAL, i.e. \diff
--- s({trig = "df", snippetType="autosnippet", snippetType="autosnippet"},
--- {
--- t("\\diff"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- BASIC INTEGRAL SYMBOL, i.e. \int
--- s({trig = "in1", snippetType="autosnippet"},
--- {
--- t("\\int"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- DOUBLE INTEGRAL, i.e. \iint
--- s({trig = "in2", snippetType="autosnippet"},
--- {
--- t("\\iint"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- TRIPLE INTEGRAL, i.e. \iiint
--- s({trig = "in3", snippetType="autosnippet"},
--- {
--- t("\\iiint"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- CLOSED SINGLE INTEGRAL, i.e. \oint
--- s({trig = "oi1", snippetType="autosnippet"},
--- {
--- t("\\oint"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- CLOSED DOUBLE INTEGRAL, i.e. \oiint
--- s({trig = "oi2", snippetType="autosnippet"},
--- {
--- t("\\oiint"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- GRADIENT OPERATOR, i.e. \grad
--- s({trig = "gdd", snippetType="autosnippet"},
--- {
--- t("\\grad "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- CURL OPERATOR, i.e. \curl
--- s({trig = "cll", snippetType="autosnippet"},
--- {
--- t("\\curl "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- DIVERGENCE OPERATOR, i.e. \divergence
--- s({trig = "DI", snippetType="autosnippet"},
--- {
--- t("\\div "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- LAPLACIAN OPERATOR, i.e. \laplacian
--- s({trig = "laa", snippetType="autosnippet"},
--- {
--- t("\\laplacian "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- PARALLEL SYMBOL, i.e. \parallel
--- s({trig = "||", snippetType="autosnippet"},
--- {
--- t("\\parallel"),
--- }
--- ),
--- -- CDOTS, i.e. \cdots
--- s({trig = "cdd", snippetType="autosnippet"},
--- {
--- t("\\cdots"),
--- }
--- ),
--- -- LDOTS, i.e. \ldots
--- s({trig = "ldd", snippetType="autosnippet"},
--- {
--- t("\\ldots"),
--- }
--- ),
--- -- EQUIV, i.e. \equiv
--- s({trig = "eqq", snippetType="autosnippet"},
--- {
--- t("\\equiv "),
--- }
--- ),
--- -- SETMINUS, i.e. \setminus
--- s({trig = "stm", snippetType="autosnippet"},
--- {
--- t("\\setminus "),
--- }
--- ),
--- -- SUBSET, i.e. \subset
--- s({trig = "sbb", snippetType="autosnippet"},
--- {
--- t("\\subset "),
--- }
--- ),
--- -- APPROX, i.e. \approx
--- s({trig = "px", snippetType="autosnippet"},
--- {
--- t("\\approx "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- PROPTO, i.e. \propto
--- s({trig = "pt", snippetType="autosnippet"},
--- {
--- t("\\propto "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- -- COLON, i.e. \colon
--- s({trig = "::", snippetType="autosnippet"},
--- {
--- t("\\colon "),
--- }
--- ),
--- -- IMPLIES, i.e. \implies
--- s({trig = ">>", snippetType="autosnippet"},
--- {
--- t("\\implies "),
--- }
--- ),
--- -- DOT PRODUCT, i.e. \cdot
--- s({trig = ",.", snippetType="autosnippet"},
--- {
--- t("\\cdot "),
--- }
--- ),
--- -- CROSS PRODUCT, i.e. \times
--- s({trig = "xx", snippetType="autosnippet"},
--- {
--- t("\\times "),
--- }
--- ),
-}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/new.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/new.lua
deleted file mode 100644
index 0ca73da4..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/new.lua
+++ /dev/null
@@ -1,51 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
-end
-local function char_count_same(c1, c2)
- local line = vim.api.nvim_get_current_line()
- -- '%'-escape chars to force explicit match (gsub accepts patterns).
- -- second return value is number of substitutions.
- local _, ct1 = string.gsub(line, '%' .. c1, '')
- local _, ct2 = string.gsub(line, '%' .. c2, '')
- return ct1 == ct2
-end
-
-local function even_count(c)
- local line = vim.api.nvim_get_current_line()
- local _, ct = string.gsub(line, c, '')
- return ct % 2 == 0
-end
-
-local function neg(fn, ...)
- return not fn(...)
-end
-
-local function part(fn, ...)
- local args = { ... }
- return function() return fn(unpack(args)) end
-end
-
--- This makes creation of pair-type snippets easier.
-local function pair(pair_begin, pair_end, expand_func, ...)
- -- triggerd by opening part of pair, wordTrig=false to trigger anywhere.
- -- ... is used to pass any args following the expand_func to it.
- return s({ trig = pair_begin, wordTrig = false, snippetType = "autosnippet" }, {
- t({ pair_begin }), d(1, get_visual), t({ pair_end })
- }, {
- condition = part(expand_func, part(..., pair_begin, pair_end))
- })
-end
-
-return {
- pair("(", ")", neg, char_count_same),
- pair("{", "}", neg, char_count_same),
- pair("[", "]", neg, char_count_same),
- pair("<", ">", neg, char_count_same),
- pair("'", "'", neg, even_count),
- pair('"', '"', neg, even_count),
- pair("`", "`", neg, even_count),
-}
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/static.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/static.lua
deleted file mode 100644
index b064ce7b..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/static.lua
+++ /dev/null
@@ -1,94 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
-end
-
-local line_begin = require("luasnip.extras.expand_conditions").line_begin
-
--- Environment/syntax context detection
-local tex = {}
-tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
-tex.in_text = function() return not tex.in_mathzone() end
-tex.in_tikz = function()
- local is_inside = vim.fn['vimtex#env#is_inside']("tikzpicture")
- return (is_inside[1] > 0 and is_inside[2] > 0)
-end
-
--- Return snippet tables
-return
- {
--- s({trig="LL", snippetType="autosnippet"},
--- {
--- t("& "),
--- }
--- ),
--- s({trig="q"},
--- {
--- t("\\quad "),
--- }
--- ),
--- s({trig="qq", snippetType="autosnippet"},
--- {
--- t("\\qquad "),
--- }
--- ),
--- s({trig="np"},
--- {
--- t("\\newpage"),
--- },
--- {condition = line_begin}
--- ),
--- s({trig="which", snippetType="autosnippet"},
--- {
--- t("\\text{ for which } "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- s({trig="all", snippetType="autosnippet"},
--- {
--- t("\\text{ for all } "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- s({trig="and", snippetType="autosnippet"},
--- {
--- t("\\quad \\text{and} \\quad"),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- s({trig="forall", snippetType="autosnippet"},
--- {
--- t("\\text{ for all } "),
--- },
--- {condition = tex.in_mathzone}
--- ),
--- s({trig = "toc", snippetType="autosnippet"},
--- {
--- t("\\tableofcontents"),
--- },
--- { condition = line_begin }
--- ),
- s({trig="inff", snippetType="autosnippet"},
- {
- t("\\infty"),
- }
- ),
- s({trig="ii", snippetType="autosnippet"},
- {
- t("\\item "),
- },
- { condition = line_begin }
- ),
- s({trig = "--", snippetType="autosnippet"},
- {t('% --------------------------------------------- %')},
- {condition = line_begin}
- ),
--- -- HLINE WITH EXTRA VERTICAL SPACE
--- s({trig = "hl"},
--- {t('\\hline {\\rule{0pt}{2.5ex}} \\hspace{-7pt}')},
--- {condition = line_begin}
--- ),
- }
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/system.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/system.lua
deleted file mode 100644
index d551a818..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/system.lua
+++ /dev/null
@@ -1,168 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
-end
-
-local line_begin = require("luasnip.extras.expand_conditions").line_begin
-
--- Math context detection
-local tex = {}
-tex.in_mathzone = function() return vim.fn['vimtex#syntax#in_mathzone']() == 1 end
-tex.in_text = function() return not tex.in_mathzone() end
-
--- Return snippet tables
-return
- {
--- -- ANNOTATE (custom command for annotating equation derivations)
--- s({trig = "ann", snippetType="autosnippet"},
--- fmta(
--- [[
--- \annotate{<>}{<>}
--- ]],
--- {
--- i(1),
--- d(2, get_visual),
--- }
--- )
--- ),
--- -- REFERENCE
--- s({trig = " RR", snippetType="autosnippet", wordTrig=false},
--- fmta(
--- [[
--- ~\ref{<>}
--- ]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- USE A LATEX PACKAGE
--- s({trig = "pack", snippetType="autosnippet"},
--- fmta(
--- [[
--- \usepackage{<>}
--- ]],
--- {
--- d(1, get_visual),
--- }
--- ),
--- { condition = line_begin }
--- ),
--- -- INPUT a LaTeX file
--- s({trig = "inn", snippetType="autosnippet"},
--- fmta(
--- [[
--- \input{<><>}
--- ]],
--- {
--- i(1, "~/dotfiles/config/latex/templates/"),
--- i(2)
--- }
--- ),
--- { condition = line_begin }
--- ),
--- -- LABEL
--- s({trig = "lbl", snippetType="autosnippet"},
--- fmta(
--- [[
--- \label{<>}
--- ]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- HPHANTOM
--- s({trig = "hpp", snippetType="autosnippet"},
--- fmta(
--- [[
--- \hphantom{<>}
--- ]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- s({trig = "TODOO", snippetType="autosnippet"},
--- fmta(
--- [[\TODO{<>}]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- s({trig="nc"},
--- fmta(
--- [[\newcommand{<>}{<>}]],
--- {
--- i(1),
--- i(2)
--- }
--- ),
--- {condition = line_begin}
--- ),
--- s({trig="sii", snippetType="autosnippet"},
--- fmta(
--- [[\si{<>}]],
--- {
--- i(1),
--- }
--- )
--- ),
--- s({trig="SI", snippetType="autosnippet"},
--- fmta(
--- [[\SI{<>}{<>}]],
--- {
--- i(1),
--- i(2)
--- }
--- )
--- ),
--- s({trig="url"},
--- fmta(
--- [[\url{<>}]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- VSPACE
--- s({trig="vs"},
--- fmta(
--- [[\vspace{<>}]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- SECTION
--- s({trig="h1", snippetType="autosnippet"},
--- fmta(
--- [[\section{<>}]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- SUBSECTION
--- s({trig="h2", snippetType="autosnippet"},
--- fmta(
--- [[\subsection{<>}]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
--- -- SUBSUBSECTION
--- s({trig="h3", snippetType="autosnippet"},
--- fmta(
--- [[\subsubsection{<>}]],
--- {
--- d(1, get_visual),
--- }
--- )
--- ),
- }
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/tmp.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/tmp.lua
deleted file mode 100644
index c0acfb3a..00000000
--- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/tmp.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-local get_visual = function(args, parent)
- if (#parent.snippet.env.SELECT_RAW > 0) then
- return sn(nil, i(1, parent.snippet.env.SELECT_RAW))
- else
- return sn(nil, i(1, ''))
- end
-end
-
-local line_begin = require("luasnip.extras.expand_conditions").line_begin
-
-return {
- -- s({trig="up"},
- -- fmta(
- -- [[
- -- \usepackage<>{<>}
- -- ]],
- -- {
- -- -- c(1, {t(""), sn(nil, {t("["), i(1, "options"), t("]")})}),
- -- c(1, {sn(nil, {t("["), i(1, "options"), t("]")}), t("")}),
- -- i(2, "name"),
- -- }
- -- )
- -- ),
-}