From 3c99db8650758e7c91eae8da3f8a2828388f0e45 Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Sun, 13 Oct 2024 08:00:44 +0200 Subject: [PATCH] Port more abbreviations to miros --- flake.lock | 18 ++-- home/features/neovim/config/ftplugin/tex.lua | 94 ---------------- .../features/neovim/config/ftplugin/typst.lua | 1 - .../config/lua/my/abbreviations/math.lua | 39 ------- .../neovim/snippets/common/math-phrases.miros | 47 +++++--- home/features/neovim/snippets/tex.miros | 102 +++++++++++------- home/features/neovim/snippets/typst.miros | 2 + hosts/nixos/lapetus/services/invidious.nix | 1 + 8 files changed, 107 insertions(+), 197 deletions(-) delete mode 100644 home/features/neovim/config/lua/my/abbreviations/math.lua diff --git a/flake.lock b/flake.lock index 6f323ce..c6d7fce 100644 --- a/flake.lock +++ b/flake.lock @@ -491,18 +491,18 @@ }, "locked": { "dir": "pkgs/firefox-addons", - "lastModified": 1723521794, - "narHash": "sha256-mmcakr+6z7/SDg+e2p1TYQorjYvUzWqG2KUIsmikARM=", + "lastModified": 1728792245, + "narHash": "sha256-u3DIFQ26jtO9kgxSXMVYYdjSF8VArR0jA0N7ns1wWoo=", "ref": "refs/heads/master", - "rev": "abafaabfa893ac432bae898a8652bc4a83c49d27", - "revCount": 3727, + "rev": "8064396aa8c2491dcecbedf9c71140936f032056", + "revCount": 3842, "type": "git", - "url": "https://gitlab.com/rycee/nur-expressions?dir=pkgs/firefox-addons" + "url": "https://gitlab.com/rycee/nur-expressions" }, "original": { "dir": "pkgs/firefox-addons", "type": "git", - "url": "https://gitlab.com/rycee/nur-expressions?dir=pkgs/firefox-addons" + "url": "https://gitlab.com/rycee/nur-expressions" } }, "flake-compat": { @@ -1274,11 +1274,11 @@ "purifix": "purifix" }, "locked": { - "lastModified": 1728771451, - "narHash": "sha256-WazYd0cPY7FqDanOfyMf9qiciSj2wEL8NJ1sV8LV4Rs=", + "lastModified": 1728796450, + "narHash": "sha256-16AGyN4HddZXQFaxYZjPVYxSd4b2pKJ7wUwiNgHHXQs=", "owner": "prescientmoon", "repo": "miros", - "rev": "2e49f31f22855d1428ab693cf7d0e25b839dce28", + "rev": "21e1332cc763049e27f6597967b3ac2f73fa7599", "type": "github" }, "original": { diff --git a/home/features/neovim/config/ftplugin/tex.lua b/home/features/neovim/config/ftplugin/tex.lua index d1998bf..b58d3e1 100644 --- a/home/features/neovim/config/ftplugin/tex.lua +++ b/home/features/neovim/config/ftplugin/tex.lua @@ -1,95 +1 @@ -local A = require("my.abbreviations") -local scrap = require("scrap") - -require("my.abbreviations.math").setup() - vim.opt.conceallevel = 0 - -local abbreviations = { - -- Other fancy symvols - { "tmat", "^T" }, -- Transpose of a matrix - { "cmat", "^*" }, -- Conjugate of a matrix - { "sneg", "^C" }, -- Set complement - { "ortco", "^\\bot" }, -- Orthogonal complement - { "sinter", "^\\circ" }, -- Interior of a set - { "nuls", "\\varnothing" }, - - -- Basic commands - { "mangle", "\\measuredangle" }, - { "aangle", "\\angle" }, - { "sdiff", "\\setminus" }, - { "sst", "\\subset" }, - { "spt", "\\supset" }, - { "sseq", "\\subseteq" }, - { "speq", "\\supseteq" }, - { "ccan", "\\cancel" }, - { "com", "\\circ" }, - { "mul", "\\cdot" }, - { "smul", "\\times" }, - { "card", "\\#" }, - { "div", "\\|" }, - { "ndiv", "\\not\\|\\:" }, - { "perp", "\\perp" }, - { "cdots", "\\cdots" }, -- center dots - { "ldots", "\\ldots" }, -- low dots - { "cldots", ",\\ldots," }, -- comma, low dots - { "frac", "\\frac" }, -- fraction - { "lim", "\\lim" }, -- Limit - { "sup", "\\sup" }, -- supremum - { "limsup", "\\lim\\sup" }, -- Limit of the supremum - { "cal", "\\mathcal" }, -- Limit of the supremum -} - -local abolishAbbreviations = { - -- {{{ Set symbols - -- - nats => naturals - -- - ints => integers - -- - rats => rationals - -- - irats => irationals - -- - rrea => reals - -- - comp => complex - -- - ppri => primes - -- - ffie => fields - { - "{nats,ints,rats,irats,rrea,comp,ppri,ffie}", - "\\mathbb\\{{N,Z,Q,I,R,C,P,F}\\}", - options = A.no_capitalization, - }, - -- }}} - -- {{{ Graph theory - -- Graph theory function syntax: - -- gt[function]{graph}{modifier} - -- - function: - -- - basic functions: e/E/v/G/L - -- - k => connectivity - -- - a => size of the biggest stable set - -- - w => size of the biggest clique - -- - d => biggest degree - -- - c{target}{kind} => {target} {kind} chromatic number - -- - target: - -- - vertices by default - -- - e => edges - -- - kind: - -- - normal by default - -- - l => list - -- - graph: - -- - G by default - -- - s/x/y/h => S/X/Y/H - -- - modifier: - -- - a => ' - -- - 1/2 => _k - { - "gt{{e,E,v,V,L},k,a,w,d,md{,e},c{,e}{,l}}{,s,h,x,y}{,a,1,2}", - "{{},\\kappa,\\alpha,\\omega,\\Delta,\\delta{,'},\\chi{,'}{,_l}}({G,S,H,X,Y}{,',_1,_2})", - options = A.no_capitalization, - }, - -- }}} -} - -local expanded = scrap.expand_many(abolishAbbreviations) - --- Last I checked this contained 1229 abbreviations --- print(#abbreviations + #expanded) - -A.manyLocalAbbr(abbreviations) -A.manyLocalAbbr(expanded) diff --git a/home/features/neovim/config/ftplugin/typst.lua b/home/features/neovim/config/ftplugin/typst.lua index 6636bc6..4429380 100644 --- a/home/features/neovim/config/ftplugin/typst.lua +++ b/home/features/neovim/config/ftplugin/typst.lua @@ -1,2 +1 @@ -require("my.abbreviations.math").setup() require("my.abbreviations.unicode").setup() diff --git a/home/features/neovim/config/lua/my/abbreviations/math.lua b/home/features/neovim/config/lua/my/abbreviations/math.lua deleted file mode 100644 index b66a8c4..0000000 --- a/home/features/neovim/config/lua/my/abbreviations/math.lua +++ /dev/null @@ -1,39 +0,0 @@ -local A = require("my.abbreviations") -local scrap = require("scrap") -local M = {} - -local function nocap(d) - d.options = A.no_capitalization - return d -end - -M.words = { - -- {{{ Linear algebra - { "rref", "reduced row echalon form" }, - { "eg{va,ve,p}{,s}", "eigen{value,vector,pair}{}" }, - { "mx{,s}", "matri{x,ces}" }, - { "dete{,s}", "determinant{}" }, - { "ort{n,g}", "orto{normal,gonal}" }, - { "l{in,de}", "linearly {independent,dependent}" }, - { "lcon{,s}", "linear combination{}" }, - { "vst{,s}", "vector space{}" }, -- text vector space - nocap({ "rizz", "Riesz vector" }), -- 💀 - -- }}} - -- {{{ Differential equations - -- 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{}" }, - -- }}} -} - -function M.setup() - A.manyGlobalAbbr(scrap.expand_many(M.words)) -end - -return M diff --git a/home/features/neovim/snippets/common/math-phrases.miros b/home/features/neovim/snippets/common/math-phrases.miros index 1183726..b24aa90 100644 --- a/home/features/neovim/snippets/common/math-phrases.miros +++ b/home/features/neovim/snippets/common/math-phrases.miros @@ -1,23 +1,36 @@ -block !word - for s <- @⟨,s⟩ +block auto !word + block capitalize + abbr bcla by contradiction let's assume + abbr wlg without loss of generality + abbr tits that is to say, + abbr wpbd we will prove the statement in both directions. + abbr itf it then follows - block - for b <- @⟨b,B⟩ - for w <- @⟨w,W⟩ - for t <- @⟨w,W⟩ + for who <- @⟨which,this⟩ + for what <- @⟨means,implies⟩ + abbr @⟨@who:ww,tt⟩@⟨@what:m,i⟩ @who @what + abbr stam statement + abbr cox counterexample + abbr lcon linear combination + abbr vst vector space - abbr @b⋄cla @b⋄y contradiction let's assume - abbr @w⋄lg @w⋄ithout loss of generality - abbr @t⋄its @t⋄hat is to say, - abbr @w⋄pbd @w⋄e will prove the statement in both directions. - - abbr stam@s statement@s - abbr cex@s counterexample@s - - for who <- @⟨which, this⟩ - for what <- @⟨means, implies⟩ - abbr @who@what @⟨@who:which,this⟩@⟨@what:means,implies⟩ + abbr vx vertex + abbr mx matrix + abbr vertexs vertices + abbr matrixs matrices for kind <- @⟨parts,substitution⟩ abbr ib@⟨@kind:p,s⟩ integration by @kind + + for kind <- @⟨independent,dependent⟩ + abbr l@⟨@kind:ind,de⟩ linearly @kind + + for kind <- @⟨value,vector,pair⟩ + abbr eg@⟨@kind:va,ve,p⟩ eigen@kind + + for kind <- @⟨orthogonal,orthonormal⟩ + abbr @⟨@kind:ortg,ortn⟩ @kind + + for kind <- @⟨scalar,ordinary,linear,⟩ + abbr @⟨@kind:s,o,l,⟩deq @kind differential equation diff --git a/home/features/neovim/snippets/tex.miros b/home/features/neovim/snippets/tex.miros index 3c3907b..68406f4 100644 --- a/home/features/neovim/snippets/tex.miros +++ b/home/features/neovim/snippets/tex.miros @@ -1,3 +1,6 @@ +block text + import common/math-phrases + for thmenv <- @⟨theorem,lemma,exercise,definition,corollary,example⟩ for thmprefix <- @⟨@thmenv:thm,lem,exe,def,cor,exa⟩ @@ -164,51 +167,75 @@ block math ⟩}}$0 block auto - for constkind <- @⟨default,shortened⟩ - for constant <- @⟨@constkind: - @⟨star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega,half,ordop,land,lor⟩, - @⟨lam,eps,iinf⟩ - ⟩ - for expansion <- @⟨@constkind: - @constant, - @⟨@constant:lambda,epsilon,ifty⟩ - ⟩ + block word + for constkind <- @⟨default,shortened⟩ + for constant <- @⟨@constkind: + @⟨star,delta,Delta,pi,tau,psi,phi,rho,sigma,alpha,beta,theta,gamma,omega,Omega,half,ordop,land,lor⟩, + @⟨lam,eps,iinf⟩ + ⟩ + for expansion <- @⟨@constkind: + @constant, + @⟨@constant:lambda,epsilon,ifty⟩ + ⟩ - for operator <- @⟨,e,s⟩ - string @operator@constant - snip @⟨@operator:,^,_⟩\\@expansion + for operator <- @⟨,e,s⟩ + string @operator@constant + snip @⟨@operator:,^,_⟩\\@expansion - abbr niinf -\ifty - abbr eniinf ^{-\ifty} - abbr sniinf _{-\ifty} + abbr niinf -\ifty + abbr eniinf ^{-\ifty} + abbr sniinf _{-\ifty} - abbr frl \forall - abbr exs \exists - abbr iin \in - abbr nin \not\in - abbr ccup \cup - abbr ccap \cap - abbr nope \bot - abbr yee \top + abbr frl \forall + abbr exs \exists - abbr nlnl \pm - abbr vsm \vecspace - abbr oball \ball + abbr card \# + abbr ccap \cap + abbr ccup \cup + abbr iin \in + abbr nin \not\in + abbr nuls \varnothing + abbr ortco ^\bot + abbr sdiff \setminus + abbr sinter ^\circ + abbr smul \times + abbr speq \supseteq + abbr spt \supset + abbr sseq \subseteq + abbr sst \subset - for noperator <- @⟨ordop,land,lor,equiv,pmod⟩ - abbr @noperator \\@noperator + abbr nope \bot + abbr yee \top - for operator <- @⟨overline,hat,bar,abs,norm,prob,diprod,sin,cos,sqrt,ln,lrb,zmod,gen,diam,prob⟩ - string @operator - snip \\@operator$|1⟨{$1}, $0⟩ + abbr ccan \cancel + abbr com \circ + abbr limsup \lim\sup + abbr mangle \measuredangle + abbr mul \cdot + abbr nlnl \pm + abbr oball \ball + abbr vsm \vecspace - for bioperator <- @⟨iprod,frac,binom,dist⟩ - string @bioperator - snip \\@bioperator$|1⟨ $1,{$1}⟩$|2⟨ $2,{$2}⟩ $0 + abbr bb \mathbb + abbr cal \mathcal - string set - desc Create a set by escaping the brackets - snip \{$1\} + for set <- @⟨N,Z,Q,I,R,C,P,F⟩ + abbr @⟨@set:nats,ints,rats,irats,rrea,comp,ppri,ffie⟩ \mathbb @set + + for noperator <- @⟨ordop,land,lor,equiv,pmod,ldots,cdots,perp,lim,angle,sup⟩ + abbr @noperator \\@noperator + + for operator <- @⟨overline,hat,bar,abs,norm,prob,diprod,sin,cos,sqrt,ln,lrb,zmod,gen,diam,prob⟩ + string @operator + snip \\@operator$|1⟨{$1}, $0⟩ + + for bioperator <- @⟨iprod,frac,binom,dist⟩ + string @bioperator + snip \\@bioperator$|1⟨ $1,{$1}⟩$|2⟨ $2,{$2}⟩ $0 + + string set + desc Create a set by escaping the brackets + snip \{$1\} pattern (.*)e@⟨t(%a),(%d)⟩ name auto exponent @@ -246,6 +273,7 @@ block math abbr .inv ^{-1} abbr .neg _- abbr .pos _+ + abbr .t ^T for limtarget <- @⟨anything,zero,infinity,negative infinity⟩ for prefix <- @⟨@limtarget:,z,i,n⟩ diff --git a/home/features/neovim/snippets/typst.miros b/home/features/neovim/snippets/typst.miros index e0363d1..4619c0f 100644 --- a/home/features/neovim/snippets/typst.miros +++ b/home/features/neovim/snippets/typst.miros @@ -1,3 +1,5 @@ +import common/math-phrases + block auto start for thmenv <- @⟨lemma,theorem,corollary,definition⟩ string @thmenv diff --git a/hosts/nixos/lapetus/services/invidious.nix b/hosts/nixos/lapetus/services/invidious.nix index 728eb4b..54b2612 100644 --- a/hosts/nixos/lapetus/services/invidious.nix +++ b/hosts/nixos/lapetus/services/invidious.nix @@ -22,6 +22,7 @@ comments = [ "youtube" "reddit" + ]; save_player_pos = true; automatic_instance_redirect = true;