From 1407178ba700fd4fea7e1b9a341d3cd781d34a89 Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:36:58 +0100 Subject: [PATCH] minor(snip): add fraction and ball snippet --- lua/typstar/snippets/letters.lua | 4 ++++ lua/typstar/snippets/math.lua | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lua/typstar/snippets/letters.lua b/lua/typstar/snippets/letters.lua index 552fff5..35dcb12 100644 --- a/lua/typstar/snippets/letters.lua +++ b/lua/typstar/snippets/letters.lua @@ -1,5 +1,6 @@ local ls = require('luasnip') local d = ls.dynamic_node +local i = ls.insert_node local s = ls.snippet_node local t = ls.text_node local helper = require('typstar.autosnippets') @@ -130,4 +131,7 @@ return { -- series of numbered letters snip('(' .. trigger_index_pre .. ') ot ', '<>_1, <>_2, ... ', { cap(1), cap(1) }, math), -- a_1, a_2, ... snip('(' .. trigger_index_pre .. ') ot(\\w+) ', '<> ', { d(1, get_series) }, math), -- a_1, a_2, ... a_j or a_1, a_2, a_2, a_3, a_4, a_5 + + -- misc + snip('(' .. trigger_index_pre .. ')bl', 'B_<> (<>)', { cap(1), i(1, 'x_0') }, math), } diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 11b1a6f..8c886d5 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -42,6 +42,15 @@ return { snip('xx', 'times ', {}, math, 900), snip('oxx', 'times.circle ', {}, math), snip('bxx', 'times.square ', {}, math), + snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, math), + + -- exponents + 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('ep', 'exp(<>) ', { i(1, '1') }, math), -- sets -- 'st' to '{<>} in ./visual.lua @@ -63,14 +72,8 @@ return { snip('mt', '|->> ', {}, math), snip('Oo', 'compose ', {}, math), snip('iso', 'tilde.equiv ', {}, math), - 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) ', {}, 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),