From 169714435ee05d22dc419cbee1a6f38cbcd79ce2 Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:11:40 +0100 Subject: [PATCH] perf(snip): make use of custom wordtrig --- lua/typstar/snippets/letters.lua | 6 +++--- lua/typstar/snippets/math.lua | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/typstar/snippets/letters.lua b/lua/typstar/snippets/letters.lua index 20b54a8..2e00003 100644 --- a/lua/typstar/snippets/letters.lua +++ b/lua/typstar/snippets/letters.lua @@ -121,9 +121,9 @@ return { 500 ), snip( - '([^\\w])(' .. trigger_index_pre .. ')' .. '(' .. trigger_index_post .. ')([^\\w])', - '<><><>', - { cap(1), d(1, get_index, {}, { user_args = { 2, 3 } }), d(2, prepend_space, {}, { user_args = { 4 } }) }, + '(' .. trigger_index_pre .. ')' .. '(' .. trigger_index_post .. ')([^\\w])', + '<><>', + { d(1, get_index, {}, { user_args = { 1, 2 } }), d(2, prepend_space, {}, { user_args = { 3 } }) }, math, 200 ), diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 84ec6fe..11b1a6f 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -34,8 +34,8 @@ return { snip('ge', '>>= ', {}, math), -- operators - snip('ak([^k ])', '+ <>', { cap(1) }, math, 100), - snip('sk([^k ])', '- <>', { cap(1) }, math, 100), + snip('ak([^k ])', '+ <>', { cap(1) }, math, 100, false), + snip('sk([^k ])', '- <>', { cap(1) }, math, 100, false), snip('oak', 'plus.circle ', {}, math), snip('bak', 'plus.square ', {}, math), snip('mak', 'plus.minus ', {}, math), @@ -66,11 +66,11 @@ return { snip('ep', 'exp(<>) ', { i(1, '1') }, math), snip('cc', 'cases(\n\t<>\n)\\', { i(1, '1') }, math), snip('(K|M|N|Q|R|S|Z)([\\dn]) ', '<><>^<> ', { cap(1), cap(1), cap(2) }, math), - snip('(.*)iv', '<>^(-1) ', { cap(1) }, math), - snip('(.*)sr', '<>^2 ', { cap(1) }, math), - snip('(.*)cb', '<>^3 ', { cap(1) }, math), - snip('(.*)jj', '<>_(<>) ', { cap(1), i(1, 'n') }, math), - snip('(.*)kk', '<>^(<>) ', { cap(1), i(1, 'n') }, math), + snip('iv', '^(-1) ', {}, math, 500, false), + snip('sr', '^2 ', {}, math, 500, false), + snip('cb', '^3 ', {}, math, 500, false), + snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, false), + snip('kk', '^(<>) ', { i(1, 'n') }, math, 500, false), snip('ddx', '(d <>)(d <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('it', 'integral ', {}, math, 900),