From 9ef93664e22a8c84d84c7a1caca135c439a32335 Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Tue, 19 Sep 2023 15:07:18 +0300
Subject: [PATCH] Add some extra latex abbreviations

---
 dotfiles/neovim/ftplugin/tex.lua | 67 ++++++++++++++++++--------------
 1 file changed, 38 insertions(+), 29 deletions(-)

diff --git a/dotfiles/neovim/ftplugin/tex.lua b/dotfiles/neovim/ftplugin/tex.lua
index 8f30fe7..63cb327 100644
--- a/dotfiles/neovim/ftplugin/tex.lua
+++ b/dotfiles/neovim/ftplugin/tex.lua
@@ -32,7 +32,7 @@ vim.opt.foldmethod = "expr"
 -- }}}
 
 local abbreviations = {
-  -- Greek chars
+  -- {{{ Greek chars
   { "eps", "\\epsilon" },
   { "delta", "\\delta" },
   { "Delta", "\\Delta" },
@@ -47,7 +47,7 @@ local abbreviations = {
   { "omega", "\\omega" },
   { "Omega", "\\Omega" },
   { "nuls", "\\varnothing" },
-
+  -- }}}
   -- Other fancy symvols
   { "tmat", "^T" }, -- Tranpose of a matrix
   { "cmat", "^*" }, -- Conjugate of a matrix
@@ -58,7 +58,6 @@ local abbreviations = {
   -- Basic commands
   { "mangle", "\\measuredangle" },
   { "aangle", "\\angle" },
-
   { "sdiff", "\\setminus" },
   { "sst", "\\subset" },
   { "spt", "\\supset" },
@@ -67,8 +66,6 @@ local abbreviations = {
   { "nin", "\\not\\in" },
   { "iin", "\\in" },
   { "tto", "\\to" },
-  { "iip", "\\implies" },
-  { "iib", "\\impliedby" },
   { "land", "\\land" },
   { "lor", "\\lor" },
   { "ssin", "\\sin" },
@@ -102,12 +99,15 @@ local abbreviations = {
   { "prob", "\\prob" }, -- custom probability function
   { "dist", "\\dist" }, -- custom dist function
   { "diam", "\\diam" }, -- custom diam operator
+  { "gen", "\\gen" }, -- custom command for group generated by element
+  { "ord", "\\ordop" }, -- order of a group
+  { "vsm", "\\vecspace" }, -- custom math vector space
 }
 
 -- Todo: convert exponents and subscripts
 -- to use this more concise notation.
 local abolishAbbreviations = {
-  -- General phrases
+  -- {{{ General phrases
   { "thrf", "therefore" },
   { "bcla", "by contradiction let's assume" },
   { "wlg", "without loss of generality" },
@@ -117,12 +117,12 @@ local abolishAbbreviations = {
   { "{ww,tt}{m,i}", "{which,this} {means,implies}" },
   { "cex{,s}", "counterexample{}" },
   { "er{t,s,r}", "{transitivity,symmetry,reflexivity}" },
-
-  -- Calculus & analysis
+  -- }}}
+  -- {{{ Calculus & analysis
   { "ib{p,s}", "integration by {parts,substitution}" },
   { "nb{,h}{,s}", "neighbour{,hood}{}" },
-
-  -- Linear algebra
+  -- }}}
+  -- {{{ Linear algebra
   { "rref", "reduced row echalon form" },
   { "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" },
   { "mx{,s}", "matri{x,ces}" },
@@ -130,24 +130,23 @@ local abolishAbbreviations = {
   { "ort{n,g}", "orto{normal,gonal}" },
   { "l{in,de}", "linearly {independent,dependent}" },
   { "lcon{,s}", "linear combination{}" },
-  { "vsm", "\\vecspace" }, -- math vector space
-  { "vst{,s}", "vector space{,s}" }, -- text vector space
+  { "vst{,s}", "vector space{}" }, -- text vector space
   {
     "rizz", -- ok please ignore this one 💀
     "Riesz vector",
     options = A.no_capitalization,
   },
-
-  -- Graph theory
-  { "vx{,s}", "vert{ex,ices}" },
-  { "edg{,s}", "edge{}" },
-
-  -- Linear systems
+  -- }}}
+  -- {{{ Linear systems
   -- Note: we must add the space inside the {} in order for capitalization to work!
   {
     "{{s,o,l},}deq{s,}",
     "{{scalar,ordinary,linear} ,}differential equation{}",
   },
+  -- }}}
+  -- {{{ Graph theory
+  { "vx{,s}", "vert{ex,ices}" },
+  { "edg{,s}", "edge{}" },
 
   -- Graph theory function syntax:
   --   gt[function]{graph}{modifier}
@@ -175,19 +174,19 @@ local abolishAbbreviations = {
     "{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})",
     options = A.no_capitalization,
   },
-
-  -- My own operator syntax:
+  -- }}}
+  -- {{{ My own operator syntax:
   --   - Any operator can be prefixed with "a" to
   --     align in aligned mode
   --   - Any operator can be prefixed with cr to
   --     start a new line and align in aligned mode
   {
-    "{cr,a,}{eq,neq,leq,geq,lt,gt,iff}",
-    "{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>,\\iff}",
+    "{cr,a,}{eq,neq,leq,geq,lt,gt,iff,iip,iib}",
+    "{\\\\\\&,&,}{=,\\neq,\\leq,\\geq,<,>,\\iff,\\implies,\\impliedby}",
     options = A.no_capitalization,
   },
-
-  -- Exponents and subscripts:
+  -- }}}
+  -- {{{ Exponents and subscripts:
   --   {operation}{argument}
   --   - operation = e (exponent) | s (subscript)
   --   - argument = t{special} | {basic}
@@ -201,8 +200,8 @@ local abolishAbbreviations = {
     "{^,_}{{},{\\{-1\\},-,+}}",
     options = A.no_capitalization,
   },
-
-  -- Set symbols
+  -- }}}
+  -- {{{ Set symbols
   --   - nats => naturals
   --   - ints => integers
   --   - rats => rationals
@@ -216,8 +215,8 @@ local abolishAbbreviations = {
     "\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}",
     options = A.no_capitalization,
   },
-
-  -- Function calls:
+  -- }}}
+  -- {{{ General function calls:
   --   {function-name}{modifier?}{argument}{argument-modifier?}
   --
   --   - function-name = f/g/h/P
@@ -233,13 +232,23 @@ local abolishAbbreviations = {
     "{f,g,h,P}{d,2,3,i,}{x,y,z,a,t,i,n,k}{n,}",
     "{}{',^2,^3,^\\{-1\\},}({}{_n,})",
   },
+  -- }}}
 }
 
 local expanded = scrap.expand_many(abolishAbbreviations)
 
--- Last I checked this contained 1166 abbreviations
+-- Last I checked this contained 1179 abbreviations
 -- print(#abbreviations + #expanded)
 
+local all = ""
+for _, v in pairs(abbreviations) do
+  all = all .. v[1] .. " " .. v[2] .. "\n"
+end
+for _, v in pairs(expanded) do
+  all = all .. v[1] .. " " .. v[2] .. "\n"
+end
+print(all)
+
 A.manyLocalAbbr(abbreviations)
 A.manyLocalAbbr(expanded)