From b9a9512ee970d3cfadda3a7924687088bf33f513 Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Sun, 3 Aug 2025 12:13:00 +0200 Subject: [PATCH] minor(snip)!: require space after simple functions --- README.md | 1 + lua/typstar/snippets/math.lua | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a415a2..7d03ca9 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Math snippets: - [Many shorthands](./lua/typstar/snippets/math.lua) for mathematical expressions - Series of numbered letters: ` ot ` → `_1, _2, ... ` (e.g. `a ot ` → `a_1, a_2, ... `, `a ot4 ` → `a_1, a_2, a_3, a_4 `, `alpha otk ` → `alpha_1, alpha_2, ..., alpha_k `) - Wrapping of any mathematical expression (see [operations](./lua/typstar/snippets/visual.lua), works nested, multiline and in visual mode via the [selection key](#installation)): `` → `()` (e.g. `(a^2+b^2)rt` → `sqrt(a^2+b^2)`, `lambdatd` → `tilde(lambda)`, `(1+1)sQ` → `[1+1]`, `(1+1)sq` → `[(1+1)]`) +- Simple functions: `fo ` → `f() ` (e.g. `fox ` → `f(x) `, `ao5 ` → `a(5) `) - Matrices: `ma` and `lma` (e.g. `23ma` → 2x3 matrix) Note that you can [customize](#custom-snippets) (enable, disable and modify) every snippet. diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index c885cc5..5799f07 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -73,9 +73,9 @@ return { snip('Oo', 'compose ', {}, math), snip('iso', 'tilde.equiv ', {}, math), snip('cc', 'cases(\n\t<>\n)\\', { i(1, '1') }, math), - snip('([A-Za-z])o([A-Za-z0-9])', '<>(<>) ', { cap(1), cap(2) }, math, 100, { - maxTrigLength = 3, - blacklist = { 'bot', 'col', 'com', 'con', 'cos', 'cot', 'dol', 'dot', 'log', 'loz', 'mod', 'roo', 'top', 'won', 'xor' }, + snip('([A-Za-z])o([A-Za-z0-9]) ', '<>(<>) ', { cap(1), cap(2) }, math, 100, { + maxTrigLength = 4, + blacklist = { 'bot ', 'cos ', 'cot ', 'dot ', 'log ', 'mod ', 'top ', 'won ', 'xor ' }, }), snip('(K|M|N|Q|R|S|Z)([\\dn]) ', '<><>^<> ', { cap(1), cap(1), cap(2) }, math),