From c3465da4473fdd57c796d91ed3c267e933a639e6 Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Fri, 17 Oct 2025 16:02:30 +0200 Subject: [PATCH 01/10] minor(snip)!: update plus/minus snippets --- lua/typstar/snippets/math.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 86e449c..0d7069d 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -34,11 +34,11 @@ return { snip('ge', '>>= ', {}, math), -- operators - snip('ak([^k ])', '+ <>', { cap(1) }, math, 100, { wordTrig = false }), - snip('sk([^k ])', '- <>', { cap(1) }, math, 100, { wordTrig = false }), + snip('mak', 'plus.minus ', {}, math), snip('oak', 'plus.circle ', {}, math), snip('bak', 'plus.square ', {}, math), - snip('mak', 'plus.minus ', {}, math), + snip('osk', 'minus.circle ', {}, math), + snip('bsk', 'minus.square ', {}, math), snip('xx', 'times ', {}, math), snip('oxx', 'times.circle ', {}, math), snip('bxx', 'times.square ', {}, math), From 4df11718eafae740399ecf88026e936c6537ba47 Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Fri, 17 Oct 2025 16:10:49 +0200 Subject: [PATCH 02/10] minor(snip)!: update `compose` snippet --- lua/typstar/snippets/math.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 0d7069d..21c8e1c 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -71,7 +71,7 @@ return { -- misc snip('to', '->> ', {}, math), snip('mt', '|->> ', {}, math), - snip('Oo', 'compose ', {}, math), + snip('cp', '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, { From 8695355610273534641293d7df6fcb98f5befa85 Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Mon, 20 Oct 2025 21:54:07 +0200 Subject: [PATCH 03/10] minor(snip): add `^complement` snippet --- lua/typstar/snippets/math.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 21c8e1c..3afbf54 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -47,6 +47,7 @@ return { -- exponents snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }), snip('tp', '^top ', {}, math, 500, { wordTrig = false }), + snip('cmp', '^complement ', {}, math, 500, { wordTrig = false }), snip('sr', '^2 ', {}, math, 500, { wordTrig = false }), snip('cb', '^3 ', {}, math, 500, { wordTrig = false }), snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), From a75b85e44675caa61a3743e800c88803df9dd43e Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Tue, 28 Oct 2025 17:28:19 +0100 Subject: [PATCH 04/10] feat(snip): add basic "physics" snippets --- lua/typstar/snippets/math.lua | 1 + lua/typstar/snippets/visual.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 3afbf54..fa970d6 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -74,6 +74,7 @@ return { snip('mt', '|->> ', {}, math), snip('cp', 'compose ', {}, math), snip('iso', 'tilde.equiv ', {}, math), + snip('nab', 'nabla ', {}, 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 = 4, diff --git a/lua/typstar/snippets/visual.lua b/lua/typstar/snippets/visual.lua index f5644f4..8017891 100644 --- a/lua/typstar/snippets/visual.lua +++ b/lua/typstar/snippets/visual.lua @@ -37,9 +37,11 @@ local operations = { -- first boolean: existing brackets should be kept; second { 'ht', 'hat', '', true, true }, { 'br', 'macron', '', true, true }, { 'dt', 'dot', '', true, true }, + { 'dia', 'diaer', '', true, true }, { 'ci', 'circle', '', true, true }, { 'td', 'tilde', '', true, true }, { 'nr', 'norm', '', true, true }, + { 'arr', 'arrow', '', true, true }, { 'vv', 'vec', '', true, true }, { 'rt', 'sqrt', '', true, true }, { 'flo', 'floor', '', true, true }, From e0184b8a4ed7d4a015bb3b2dca5477c907cd6b3b Mon Sep 17 00:00:00 2001 From: arne314 <73391160+arne314@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:10:57 +0100 Subject: [PATCH 05/10] refactor(snip): reorder math snippets --- lua/typstar/snippets/math.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index fa970d6..f253500 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -9,7 +9,6 @@ local cap = helper.cap return { snip('fa', 'forall ', {}, math), snip('ex', 'exists ', {}, math), - snip('ni', 'in.not ', {}, math), snip('Sq', 'square', {}, math), -- logical chunks @@ -19,6 +18,8 @@ return { snip('een', 'exists epsilon>>0 ', {}, math), -- boolean logic + snip('and', 'and ', {}, math), + snip('or', 'or ', {}, math), snip('not', 'not ', {}, math), snip('ip', '==>> ', {}, math), snip('ib', '<<== ', {}, math), @@ -44,7 +45,7 @@ return { snip('bxx', 'times.square ', {}, math), snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, math), - -- exponents + -- subscript/superscript snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }), snip('tp', '^top ', {}, math, 500, { wordTrig = false }), snip('cmp', '^complement ', {}, math, 500, { wordTrig = false }), @@ -52,10 +53,9 @@ return { snip('cb', '^3 ', {}, math, 500, { wordTrig = false }), snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), snip('kk', '^(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), - snip('ep', 'exp(<>) ', { i(1, '1') }, math), -- sets - -- 'st' to '{<>} in ./visual.lua + -- 'st' to '{<>}' in ./visual.lua snip('set', '{<> mid(|) <>}', { i(1), i(2) }, math), snip('es', 'emptyset ', {}, math), snip('ses', '{emptyset} ', {}, math), @@ -68,6 +68,7 @@ return { snip('bnn', 'inter.big ', {}, math), snip('buu', 'union.big ', {}, math), snip('swo', 'without ', {}, math), + snip('ni', 'in.not ', {}, math), -- misc snip('to', '->> ', {}, math), @@ -75,31 +76,37 @@ return { snip('cp', 'compose ', {}, math), snip('iso', 'tilde.equiv ', {}, math), snip('nab', 'nabla ', {}, math), + snip('ep', 'exp(<>) ', { i(1, '1') }, 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 = 4, - blacklist = { 'bot ', 'cos ', 'cot ', 'dot ', 'log ', 'mod ', 'top ', 'won ', 'xor ' }, + blacklist = { 'bot ', 'cos ', 'cot ', 'dot ', 'log ', 'mod ', 'not ', 'top ', 'won ', 'xor ' }, }), snip('(K|M|N|Q|R|S|Z)([\\dn]) ', '<><>^<> ', { cap(1), cap(1), cap(2) }, math), + -- derivatives snip('dx', 'dif / (dif <>) ', { i(1, 'x') }, math), snip('ddx', '(dif <>) / (dif <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('DX', 'diff / (diff <>) ', { i(1, 'x') }, math), snip('DDX', '(diff <>) / (diff <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('part', 'partial ', {}, math, 1600), + -- integrals snip('it', 'integral ', {}, math), snip('int', 'integral_(<>)^(<>) ', { i(1, 'a'), i(2, 'b') }, math), snip('oit', 'integral.cont_(<>) ', { i(1, 'C') }, math), snip('dit', 'integral_(<>) ', { i(1, 'Omega') }, math), + -- sums snip('sm', 'sum ', {}, math), snip('sum', 'sum_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'oo') }, math), snip('dsm', 'sum_(<>) ', { i(1, 'Omega') }, math), + -- products snip('prd', 'product ', {}, math), snip('prod', 'product_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'n') }, math), + -- limits snip('lm', 'lim ', {}, math), snip('lim', 'lim_(<> ->> <>) ', { i(1, 'n'), i(2, 'oo') }, math), snip('lim (sup|inf)', 'lim<> ', { cap(1) }, math), From fd598779b6524aa2848aa5235dd67b35827b5149 Mon Sep 17 00:00:00 2001 From: arne314 Date: Mon, 3 Nov 2025 21:27:19 +0100 Subject: [PATCH 06/10] minor(snip): add `^perp` snippet --- lua/typstar/snippets/math.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index f253500..1870d6d 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -49,6 +49,7 @@ return { snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }), snip('tp', '^top ', {}, math, 500, { wordTrig = false }), snip('cmp', '^complement ', {}, math, 500, { wordTrig = false }), + snip('prp', '^perp ', {}, math, 500, { wordTrig = false }), snip('sr', '^2 ', {}, math, 500, { wordTrig = false }), snip('cb', '^3 ', {}, math, 500, { wordTrig = false }), snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), From f43fa4d1757fed1540fef2cf8b4a0569f9f5a4e6 Mon Sep 17 00:00:00 2001 From: arne314 Date: Tue, 4 Nov 2025 22:33:41 +0100 Subject: [PATCH 07/10] feat(snip)!: Typst `0.14` compatibility --- lua/typstar/snippets/math.lua | 12 ++++++------ lua/typstar/snippets/visual.lua | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/typstar/snippets/math.lua b/lua/typstar/snippets/math.lua index 1870d6d..f1a97f4 100644 --- a/lua/typstar/snippets/math.lua +++ b/lua/typstar/snippets/math.lua @@ -36,12 +36,12 @@ return { -- operators snip('mak', 'plus.minus ', {}, math), - snip('oak', 'plus.circle ', {}, math), + snip('oak', 'plus.o ', {}, math), snip('bak', 'plus.square ', {}, math), - snip('osk', 'minus.circle ', {}, math), + snip('osk', 'minus.o ', {}, math), snip('bsk', 'minus.square ', {}, math), snip('xx', 'times ', {}, math), - snip('oxx', 'times.circle ', {}, math), + snip('oxx', 'times.o ', {}, math), snip('bxx', 'times.square ', {}, math), snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, math), @@ -78,7 +78,7 @@ return { snip('iso', 'tilde.equiv ', {}, math), snip('nab', 'nabla ', {}, math), snip('ep', 'exp(<>) ', { i(1, '1') }, math), - snip('cc', 'cases(\n\t<>\n)\\', { i(1, '1') }, math), + snip('ccs', 'cases(\n\t<>,\n)', { i(1, '1') }, math), snip('([A-Za-z])o([A-Za-z0-9]) ', '<>(<>) ', { cap(1), cap(2) }, math, 100, { maxTrigLength = 4, blacklist = { 'bot ', 'cos ', 'cot ', 'dot ', 'log ', 'mod ', 'not ', 'top ', 'won ', 'xor ' }, @@ -88,8 +88,8 @@ return { -- derivatives snip('dx', 'dif / (dif <>) ', { i(1, 'x') }, math), snip('ddx', '(dif <>) / (dif <>) ', { i(1, 'f'), i(2, 'x') }, math), - snip('DX', 'diff / (diff <>) ', { i(1, 'x') }, math), - snip('DDX', '(diff <>) / (diff <>) ', { i(1, 'f'), i(2, 'x') }, math), + snip('DX', 'partial / (partial <>) ', { i(1, 'x') }, math), + snip('DDX', '(partial <>) / (partial <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('part', 'partial ', {}, math, 1600), -- integrals diff --git a/lua/typstar/snippets/visual.lua b/lua/typstar/snippets/visual.lua index 8017891..a4b6655 100644 --- a/lua/typstar/snippets/visual.lua +++ b/lua/typstar/snippets/visual.lua @@ -28,7 +28,7 @@ local operations = { -- first boolean: existing brackets should be kept; second { 'sQ', '[', ']', false, false }, -- replace with square brackets { 'BB', '', '', false, false }, -- remove brackets { 'ss', '"', '"', false, false }, - { 'agl', 'lr(angle.l ', ' angle.r)', false, false }, + { 'chv', 'lr(chevron.l ', ' chevron.r)', false, false }, { 'abs', 'abs', '', true, true }, { 'ul', 'underline', '', true, true }, { 'ol', 'overline', '', true, true }, From d6ba115ac7f7e20d04b8952eb27ee117ec521e83 Mon Sep 17 00:00:00 2001 From: arne314 Date: Tue, 4 Nov 2025 22:50:55 +0100 Subject: [PATCH 08/10] chore: update nix flake --- .gitignore | 1 + flake.lock | 18 +++++++++--------- flake.nix | 4 ---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 1bae829..7d618ad 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .obsidian assets +result diff --git a/flake.lock b/flake.lock index 256b9fe..ba8c867 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1749398372, - "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "lastModified": 1762040540, + "narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", + "rev": "0010412d62a25d959151790968765a70c436598b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1750386251, - "narHash": "sha256-1ovgdmuDYVo5OUC5NzdF+V4zx2uT8RtsgZahxidBTyw=", + "lastModified": 1762156382, + "narHash": "sha256-Yg7Ag7ov5+36jEFC1DaZh/12SEXo6OO3/8rqADRxiqs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "076e8c6678d8c54204abcb4b1b14c366835a58bb", + "rev": "7241bcbb4f099a66aafca120d37c65e8dda32717", "type": "github" }, "original": { @@ -36,11 +36,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1748740939, - "narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=", + "lastModified": 1761765539, + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "656a64127e9d791a334452c6b6606d17539476e2", + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f2e7871..f6c6b56 100644 --- a/flake.nix +++ b/flake.nix @@ -28,10 +28,6 @@ pkgs.vimPlugins.luasnip pkgs.vimPlugins.nvim-treesitter-parsers.typst ]; - # TODO: make this check pass instead of skipping - neovimRequireCheckHook = '' - echo "Skipping neovimRequireCheckHook" - ''; }; in { packages = { From 6cb071a954b71b848530696a79ee7533b463a7fe Mon Sep 17 00:00:00 2001 From: arne314 Date: Tue, 4 Nov 2025 22:51:56 +0100 Subject: [PATCH 09/10] style: format nix code --- flake.nix | 129 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/flake.nix b/flake.nix index f6c6b56..c873096 100644 --- a/flake.nix +++ b/flake.nix @@ -6,74 +6,79 @@ flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = inputs @ { - self, - nixpkgs, - flake-parts, - ... - }: - flake-parts.lib.mkFlake {inherit inputs;} { + outputs = + inputs@{ + self, + nixpkgs, + flake-parts, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; - perSystem = {system, ...}: let - pkgs = import nixpkgs {inherit system;}; - typstar = pkgs.vimUtils.buildVimPlugin { - name = "typstar"; - src = self; - buildInputs = [ - pkgs.vimPlugins.luasnip - pkgs.vimPlugins.nvim-treesitter-parsers.typst - ]; + perSystem = + { system, ... }: + let + pkgs = import nixpkgs { inherit system; }; + typstar = pkgs.vimUtils.buildVimPlugin { + name = "typstar"; + src = self; + buildInputs = [ + pkgs.vimPlugins.luasnip + pkgs.vimPlugins.nvim-treesitter-parsers.typst + ]; + }; + in + { + packages = { + default = typstar; + nvim = + let + config = pkgs.neovimUtils.makeNeovimConfig { + customRC = '' + lua << EOF + print("Welcome to Typstar! This is just a demo.") + + vim.g.mapleader = " " + + require('nvim-treesitter.configs').setup { + highlight = { enable = true }, + } + + local ls = require('luasnip') + ls.config.set_config({ + enable_autosnippets = true, + store_selection_keys = "", + }) + + local typstar = require('typstar') + typstar.setup({}) + + vim.keymap.set({'n', 'i'}, '', 'TypstarToggleSnippets', { silent = true, noremap = true }) + vim.keymap.set({'s', 'i'}, '', 'TypstarSmartJump', { silent = true, noremap = true }) + vim.keymap.set({'s', 'i'}, '', 'TypstarSmartJumpBack', { silent = true, noremap = true }) + + vim.keymap.set('n', 'e', 'TypstarInsertExcalidraw', { silent = true, noremap = true }) + vim.keymap.set('n', 'r', 'TypstarInsertRnote', { silent = true, noremap = true }) + vim.keymap.set('n', 'o', 'TypstarOpenDrawing', { silent = true, noremap = true }) + + vim.keymap.set('n', 'a', 'TypstarAnkiScan', { silent = true, noremap = true }) + EOF + ''; + plugins = [ + typstar + pkgs.vimPlugins.luasnip + pkgs.vimPlugins.nvim-treesitter + pkgs.vimPlugins.nvim-treesitter-parsers.typst + ]; + }; + in + pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped config; + }; }; - in { - packages = { - default = typstar; - nvim = let - config = pkgs.neovimUtils.makeNeovimConfig { - customRC = '' - lua << EOF - print("Welcome to Typstar! This is just a demo.") - - vim.g.mapleader = " " - - require('nvim-treesitter.configs').setup { - highlight = { enable = true }, - } - - local ls = require('luasnip') - ls.config.set_config({ - enable_autosnippets = true, - store_selection_keys = "", - }) - - local typstar = require('typstar') - typstar.setup({}) - - vim.keymap.set({'n', 'i'}, '', 'TypstarToggleSnippets', { silent = true, noremap = true }) - vim.keymap.set({'s', 'i'}, '', 'TypstarSmartJump', { silent = true, noremap = true }) - vim.keymap.set({'s', 'i'}, '', 'TypstarSmartJumpBack', { silent = true, noremap = true }) - - vim.keymap.set('n', 'e', 'TypstarInsertExcalidraw', { silent = true, noremap = true }) - vim.keymap.set('n', 'r', 'TypstarInsertRnote', { silent = true, noremap = true }) - vim.keymap.set('n', 'o', 'TypstarOpenDrawing', { silent = true, noremap = true }) - - vim.keymap.set('n', 'a', 'TypstarAnkiScan', { silent = true, noremap = true }) - EOF - ''; - plugins = [ - typstar - pkgs.vimPlugins.luasnip - pkgs.vimPlugins.nvim-treesitter - pkgs.vimPlugins.nvim-treesitter-parsers.typst - ]; - }; - in - pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped config; - }; - }; }; } From 89e850fce846e34e53c8d5e9288643120c40e832 Mon Sep 17 00:00:00 2001 From: arne314 Date: Tue, 4 Nov 2025 22:53:49 +0100 Subject: [PATCH 10/10] chore: bump version to `1.4.2` --- pyproject.toml | 2 +- uv.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 88d4b5c..ec48aff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "pdm.backend" [project] name = "typstar" -version = "1.4.1" +version = "1.4.2" description = "Neovim plugin for efficient note taking in Typst" authors = [ { name = "arne314" } diff --git a/uv.lock b/uv.lock index 4da37ae..ddc91d6 100644 --- a/uv.lock +++ b/uv.lock @@ -516,7 +516,7 @@ wheels = [ [[package]] name = "typstar" -version = "1.4.1" +version = "1.4.2" source = { editable = "." } dependencies = [ { name = "aiohttp" },