Compare commits

...

19 Commits

Author SHA1 Message Date
eb6c219122 Merge branch 'main' into dev 2026-01-20 10:11:12 +01:00
Jonas Hahn
57e62d11aa Minors 2025-11-16 23:02:17 +01:00
Jonas Hahn
e0a82ef957 Add deletion for drawings 2025-11-11 15:36:25 +01:00
arne314
0638638a81 docs: version info 2025-11-06 15:26:00 +01:00
Arne
b82fc5d35a Merge pull request #22 from arne314/dev
V1.4.2
2025-11-04 23:04:54 +01:00
arne314
89e850fce8 chore: bump version to 1.4.2 2025-11-04 22:53:49 +01:00
arne314
6cb071a954 style: format nix code 2025-11-04 22:52:06 +01:00
arne314
d6ba115ac7 chore: update nix flake 2025-11-04 22:52:06 +01:00
arne314
f43fa4d175 feat(snip)!: Typst 0.14 compatibility 2025-11-04 22:33:41 +01:00
arne314
fd598779b6 minor(snip): add ^perp snippet 2025-11-03 21:28:45 +01:00
Jonas Hahn
459ced0c2b Change part 2025-11-03 12:58:14 +01:00
Jonas Hahn
eda6de26bb Removed all the default inserts 2025-11-02 00:49:37 +01:00
Jonas Hahn
dc7fa65a80 Merge branch 'main' into dev 2025-10-30 09:41:08 +01:00
Jonas Hahn
b49e0262a1 Small physics helpers 2025-10-30 09:40:21 +01:00
arne314
e0184b8a4e refactor(snip): reorder math snippets 2025-10-29 21:10:57 +01:00
arne314
a75b85e446 feat(snip): add basic "physics" snippets 2025-10-28 17:28:36 +01:00
arne314
8695355610 minor(snip): add ^complement snippet 2025-10-20 21:54:07 +02:00
arne314
4df11718ea minor(snip)!: update compose snippet 2025-10-17 16:10:49 +02:00
arne314
c3465da447 minor(snip)!: update plus/minus snippets 2025-10-17 16:02:30 +02:00
11 changed files with 195 additions and 104 deletions

1
.gitignore vendored
View File

@@ -3,4 +3,5 @@
.obsidian .obsidian
assets assets
result

View File

@@ -156,6 +156,7 @@ require('typstar').setup({ -- depending on your neovim plugin system
</details> </details>
### Snippets ### Snippets
0. The snippets are designed to work with Typst `0.14`. For older versions check out the legacy `typst-0.13` branch.
1. Install [LuaSnip](https://github.com/L3MON4D3/LuaSnip/), set `enable_autosnippets = true` and set a visual mode selection key (e.g. `store_selection_keys = '<Tab>'`) in the configuration 1. Install [LuaSnip](https://github.com/L3MON4D3/LuaSnip/), set `enable_autosnippets = true` and set a visual mode selection key (e.g. `store_selection_keys = '<Tab>'`) in the configuration
2. Install [jsregexp](https://github.com/kmarius/jsregexp) as described [here](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#transformations) (You will see a warning on startup if jsregexp isn't installed properly) 2. Install [jsregexp](https://github.com/kmarius/jsregexp) as described [here](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#transformations) (You will see a warning on startup if jsregexp isn't installed properly)
3. Install [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and run `:TSInstall typst` 3. Install [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and run `:TSInstall typst`
@@ -175,7 +176,6 @@ require('typstar').setup({ -- depending on your neovim plugin system
4. See comment 4 above at Excalidraw 4. See comment 4 above at Excalidraw
### Anki ### Anki
0. Typst version `0.12.0` or higher is required
1. Install [Anki](https://apps.ankiweb.net/#download) 1. Install [Anki](https://apps.ankiweb.net/#download)
2. Install [Anki-Connect](https://ankiweb.net/shared/info/2055492159) and make sure `http://localhost` is added to `webCorsOriginList` in the Add-on config (should be added by default) 2. Install [Anki-Connect](https://ankiweb.net/shared/info/2055492159) and make sure `http://localhost` is added to `webCorsOriginList` in the Add-on config (should be added by default)
3. Install the typstar python package (I recommend using [pipx](https://github.com/pypa/pipx) via `pipx install git+https://github.com/arne314/typstar`, you will need to have python build tools and clang installed) \[Note: this may take a while\] 3. Install the typstar python package (I recommend using [pipx](https://github.com/pypa/pipx) via `pipx install git+https://github.com/arne314/typstar`, you will need to have python build tools and clang installed) \[Note: this may take a while\]

18
flake.lock generated
View File

@@ -5,11 +5,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1749398372, "lastModified": 1762040540,
"narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", "narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", "rev": "0010412d62a25d959151790968765a70c436598b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1750386251, "lastModified": 1762156382,
"narHash": "sha256-1ovgdmuDYVo5OUC5NzdF+V4zx2uT8RtsgZahxidBTyw=", "narHash": "sha256-Yg7Ag7ov5+36jEFC1DaZh/12SEXo6OO3/8rqADRxiqs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "076e8c6678d8c54204abcb4b1b14c366835a58bb", "rev": "7241bcbb4f099a66aafca120d37c65e8dda32717",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -36,11 +36,11 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1748740939, "lastModified": 1761765539,
"narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=", "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "656a64127e9d791a334452c6b6606d17539476e2", "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
"type": "github" "type": "github"
}, },
"original": { "original": {

133
flake.nix
View File

@@ -6,78 +6,79 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
}; };
outputs = inputs @ { outputs =
self, inputs@{
nixpkgs, self,
flake-parts, nixpkgs,
... flake-parts,
}: ...
flake-parts.lib.mkFlake {inherit inputs;} { }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"x86_64-darwin" "x86_64-darwin"
"aarch64-darwin" "aarch64-darwin"
]; ];
perSystem = {system, ...}: let perSystem =
pkgs = import nixpkgs {inherit system;}; { system, ... }:
typstar = pkgs.vimUtils.buildVimPlugin { let
name = "typstar"; pkgs = import nixpkgs { inherit system; };
src = self; typstar = pkgs.vimUtils.buildVimPlugin {
buildInputs = [ name = "typstar";
pkgs.vimPlugins.luasnip src = self;
pkgs.vimPlugins.nvim-treesitter-parsers.typst buildInputs = [
]; pkgs.vimPlugins.luasnip
# TODO: make this check pass instead of skipping pkgs.vimPlugins.nvim-treesitter-parsers.typst
neovimRequireCheckHook = '' ];
echo "Skipping neovimRequireCheckHook" };
''; 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 = "<Tab>",
})
local typstar = require('typstar')
typstar.setup({})
vim.keymap.set({'n', 'i'}, '<M-t>', '<Cmd>TypstarToggleSnippets<CR>', { silent = true, noremap = true })
vim.keymap.set({'s', 'i'}, '<M-j>', '<Cmd>TypstarSmartJump<CR>', { silent = true, noremap = true })
vim.keymap.set({'s', 'i'}, '<M-k>', '<Cmd>TypstarSmartJumpBack<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>e', '<Cmd>TypstarInsertExcalidraw<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>r', '<Cmd>TypstarInsertRnote<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>o', '<Cmd>TypstarOpenDrawing<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>a', '<Cmd>TypstarAnkiScan<CR>', { 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 = "<Tab>",
})
local typstar = require('typstar')
typstar.setup({})
vim.keymap.set({'n', 'i'}, '<M-t>', '<Cmd>TypstarToggleSnippets<CR>', { silent = true, noremap = true })
vim.keymap.set({'s', 'i'}, '<M-j>', '<Cmd>TypstarSmartJump<CR>', { silent = true, noremap = true })
vim.keymap.set({'s', 'i'}, '<M-k>', '<Cmd>TypstarSmartJumpBack<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>e', '<Cmd>TypstarInsertExcalidraw<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>r', '<Cmd>TypstarInsertRnote<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>o', '<Cmd>TypstarOpenDrawing<CR>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>a', '<Cmd>TypstarAnkiScan<CR>', { 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;
};
};
}; };
} }

View File

@@ -104,10 +104,64 @@ local open_drawing = function(prov)
end end
end end
local function delete_drawing(provider)
local cfg = provider[1]
local line_num = vim.api.nvim_win_get_cursor(0)[1] - 1
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
-- Find the start and end of the #figure() block containing the filename
local start_line, end_line
for i = line_num, 0, -1 do
if lines[i + 1]:match("^#figure%(") then
start_line = i
break
end
end
for i = line_num, #lines - 1 do
if lines[i + 1]:match("%)$") then
end_line = i
break
end
end
if not start_line or not end_line then
print("No #figure() block found on current line")
return
end
-- Extract filename from the block
local block_text = table.concat(vim.api.nvim_buf_get_lines(0, start_line, end_line + 1, false), "\n")
local filename = block_text:match('image%("%s*(.-)%s*"%)')
if not filename then
print("No image filename found in #figure() block")
return
end
local path = vim.fn.expand('%:p:h') .. '/' .. filename
local path_export = vim.fn.expand('%:p:h') .. '/' .. filename:match("^(.*)%.")
-- Delete files if they exist
if vim.fn.filereadable(path) == 1 then os.remove(path) end
if vim.fn.filereadable(path_export) == 1 then os.remove(path_export) end
-- Delete the lines of the #figure() block
vim.api.nvim_buf_set_lines(0, start_line, end_line + 1, false, {})
print("Deleted drawing: " .. filename)
end
function M.delete_obsidian_excalidraw() delete_drawing(excalidraw) end
function M.delete_rnote() delete_drawing(rnote) end
function M.insert_obsidian_excalidraw() insert_drawing(excalidraw) end function M.insert_obsidian_excalidraw() insert_drawing(excalidraw) end
function M.insert_rnote() insert_drawing(rnote) end function M.insert_rnote() insert_drawing(rnote) end
function M.open_obsidian_excalidraw() open_drawing({ excalidraw }) end function M.open_obsidian_excalidraw() open_drawing({ excalidraw }) end
function M.open_rnote() open_drawing({ rnote }) end function M.open_rnote() open_drawing({ rnote }) end
function M.open_drawing() open_drawing(providers) end function M.open_drawing() open_drawing(providers) end
return M return M

View File

@@ -14,7 +14,9 @@ M.setup = function(args)
vim.api.nvim_create_user_command('TypstarSmartJumpBack', function() M.smart_jump(-1) end, {}) vim.api.nvim_create_user_command('TypstarSmartJumpBack', function() M.smart_jump(-1) end, {})
vim.api.nvim_create_user_command('TypstarInsertExcalidraw', drawings.insert_obsidian_excalidraw, {}) vim.api.nvim_create_user_command('TypstarInsertExcalidraw', drawings.insert_obsidian_excalidraw, {})
vim.api.nvim_create_user_command('TypstarDeleteExcalidraw', drawings.delete_obsidian_excalidraw, {})
vim.api.nvim_create_user_command('TypstarInsertRnote', drawings.insert_rnote, {}) vim.api.nvim_create_user_command('TypstarInsertRnote', drawings.insert_rnote, {})
vim.api.nvim_create_user_command('TypstarDeleteRnote', drawings.delete_rnote, {})
vim.api.nvim_create_user_command('TypstarOpenExcalidraw', drawings.open_obsidian_excalidraw, {}) vim.api.nvim_create_user_command('TypstarOpenExcalidraw', drawings.open_obsidian_excalidraw, {})
vim.api.nvim_create_user_command('TypstarOpenRnote', drawings.open_rnote, {}) vim.api.nvim_create_user_command('TypstarOpenRnote', drawings.open_rnote, {})
vim.api.nvim_create_user_command('TypstarOpenDrawing', drawings.open_drawing, {}) vim.api.nvim_create_user_command('TypstarOpenDrawing', drawings.open_drawing, {})

View File

@@ -19,14 +19,16 @@ local ctheorems = {
{ 'def', 'definition' }, { 'def', 'definition' },
{ 'exa', 'example' }, { 'exa', 'example' },
{ 'rem', 'remark' }, { 'rem', 'remark' },
{ 'nte', 'note' },
{ 'eri', 'experiment' },
} }
local wrappings = { local wrappings = {
{ 'll', '$', '$', '1+1' }, { 'll', '$', '$', '' },
{ 'BLD', '*', '*', 'abc' }, { 'BLD', '*', '*', '' },
{ 'ITL', '_', '_', 'abc' }, { 'ITL', '_', '_', '' },
{ 'HIG', '#highlight[', ']', 'abc' }, { 'HIG', '#highlight[', ']', '' },
{ 'UND', '#underline[', ']', 'abc' }, { 'UND', '#underline[', ']', '' },
} }
local document_snippets = {} local document_snippets = {}
@@ -49,6 +51,7 @@ return {
helper.list_snip('dm', '\n$\n\t<>\n$ <>', { helper.visual(1), i(2) }, markup, 1100, { prepend = '\t' }), helper.list_snip('dm', '\n$\n\t<>\n$ <>', { helper.visual(1), i(2) }, markup, 1100, { prepend = '\t' }),
start('fla', '#flashcard(0)[<>][\n<>\n<>]', { i(1, 'flashcard'), indent_visual(2), cap(1) }, markup), start('fla', '#flashcard(0)[<>][\n<>\n<>]', { i(1, 'flashcard'), indent_visual(2), cap(1) }, markup),
start('flA', '#flashcard(0, "<>")[\n<>\n<>]', { i(1, 'flashcard'), indent_visual(2), cap(1) }, markup), start('flA', '#flashcard(0, "<>")[\n<>\n<>]', { i(1, 'flashcard'), indent_visual(2), cap(1) }, markup),
start('TAB', '#table(columns: <>,\n[<>], [<>], <>\n)', { i(1), i(2), i(3), i(4) }, markup),
snip('IMP', '$==>>$ ', {}, markup), snip('IMP', '$==>>$ ', {}, markup),
snip('IFF', '$<<==>>$ ', {}, markup), snip('IFF', '$<<==>>$ ', {}, markup),
unpack(document_snippets), unpack(document_snippets),

View File

@@ -9,7 +9,6 @@ local cap = helper.cap
return { return {
snip('fa', 'forall ', {}, math), snip('fa', 'forall ', {}, math),
snip('ex', 'exists ', {}, math), snip('ex', 'exists ', {}, math),
snip('ni', 'in.not ', {}, math),
snip('Sq', 'square', {}, math), snip('Sq', 'square', {}, math),
-- logical chunks -- logical chunks
@@ -19,6 +18,8 @@ return {
snip('een', 'exists epsilon>>0 ', {}, math), snip('een', 'exists epsilon>>0 ', {}, math),
-- boolean logic -- boolean logic
snip('and', 'and ', {}, math),
snip('or', 'or ', {}, math),
snip('not', 'not ', {}, math), snip('not', 'not ', {}, math),
snip('ip', '==>> ', {}, math), snip('ip', '==>> ', {}, math),
snip('ib', '<<== ', {}, math), snip('ib', '<<== ', {}, math),
@@ -31,30 +32,47 @@ return {
snip('gt', '>> ', {}, math), snip('gt', '>> ', {}, math),
snip('le', '<<= ', {}, math), snip('le', '<<= ', {}, math),
snip('ne', '!= ', {}, math), snip('ne', '!= ', {}, math),
snip('eel', '&= ', {}, math),
snip('ge', '>>= ', {}, math), snip('ge', '>>= ', {}, math),
-- operators -- custom
snip('ak([^k ])', '+ <>', { cap(1) }, math, 100, { wordTrig = false }), snip('mm', '- ', {}, math),
snip('sk([^k ])', '- <>', { cap(1) }, math, 100, { wordTrig = false }), snip('pl', '+ ', {}, math),
snip('oak', 'plus.circle ', {}, math), snip('nl', '\\ \n<>', {i(1)}, math),
snip('bak', 'plus.square ', {}, math), snip('pm', '+- ', {}, math),
snip('mak', 'plus.minus ', {}, math), snip('nx', '\\, space ', {}, math),
snip('xx', 'times ', {}, math), snip('nbx', '\\, quad ', {}, math),
snip('oxx', 'times.circle ', {}, math), snip('deg', 'degree ', {}, math),
snip('bxx', 'times.square ', {}, math), snip('ta', 'star ', {}, math),
snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, math), snip('del', 'Delta ', {}, math),
snip('apr', 'approx ', {}, math),
snip('pal', 'parallel ', {}, math),
snip('sa', 'space ', {}, math),
-- exponents -- operators
snip('mak', 'plus.minus ', {}, math),
snip('oak', 'plus.o ', {}, math),
snip('bak', 'plus.square ', {}, math),
snip('osk', 'minus.o ', {}, math),
snip('bsk', 'minus.square ', {}, math),
snip('xx', 'times ', {}, math),
snip('oxx', 'times.o ', {}, math),
snip('bxx', 'times.square ', {}, math),
snip('ff', '(<>) / (<>) <>', { i(1), i(2), i(3) }, math),
snip('nab', 'arrow(nabla) ', {}, math),
-- subscript/superscript
snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }), snip('iv', '^(-1) ', {}, math, 500, { wordTrig = false, blacklist = { 'equiv' } }),
snip('tp', '^top ', {}, math, 500, { wordTrig = false }), 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('sr', '^2 ', {}, math, 500, { wordTrig = false }),
snip('cb', '^3 ', {}, math, 500, { wordTrig = false }), snip('cb', '^3 ', {}, math, 500, { wordTrig = false }),
snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), snip('jj', '_(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }),
snip('kk', '^(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }), snip('kk', '^(<>) ', { i(1, 'n') }, math, 500, { wordTrig = false }),
snip('ep', 'exp(<>) ', { i(1, '1') }, math),
-- sets -- sets
-- 'st' to '{<>} in ./visual.lua -- 'st' to '{<>}' in ./visual.lua
snip('set', '{<> mid(|) <>}', { i(1), i(2) }, math), snip('set', '{<> mid(|) <>}', { i(1), i(2) }, math),
snip('es', 'emptyset ', {}, math), snip('es', 'emptyset ', {}, math),
snip('ses', '{emptyset} ', {}, math), snip('ses', '{emptyset} ', {}, math),
@@ -67,37 +85,45 @@ return {
snip('bnn', 'inter.big ', {}, math), snip('bnn', 'inter.big ', {}, math),
snip('buu', 'union.big ', {}, math), snip('buu', 'union.big ', {}, math),
snip('swo', 'without ', {}, math), snip('swo', 'without ', {}, math),
snip('ni', 'in.not ', {}, math),
-- misc -- misc
snip('to', '->> ', {}, math), snip('to', '->> ', {}, math),
snip('mt', '|->> ', {}, math), snip('mt', '|->> ', {}, math),
snip('Oo', 'compose ', {}, math), snip('cp', 'compose ', {}, math),
snip('iso', 'tilde.equiv ', {}, math), snip('iso', 'tilde.equiv ', {}, math),
snip('cc', 'cases(\n\t<>\n)\\', { i(1, '1') }, math), snip('cc', 'cases(\n\t<>\n)\\', { i(1) }, math),
snip('([A-Za-z])o([A-Za-z0-9]) ', '<>(<>) ', { cap(1), cap(2) }, math, 100, { snip('([A-Za-z])o([A-Za-z0-9]) ', '<>(<>) ', { cap(1), cap(2) }, math, 100, {
maxTrigLength = 4, 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), 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('dx', 'dif / (dif <>) ', { i(1, 'x') }, math),
snip('ddx', '(dif <>) / (dif <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('ddx', '(dif <>) / (dif <>) ', { i(1, 'f'), i(2, 'x') }, math),
snip('DX', 'diff / (diff <>) ', { i(1, 'x') }, math), snip('DX', 'partial / (partial <>) ', { i(1, 'x') }, math),
snip('DDX', '(diff <>) / (diff <>) ', { i(1, 'f'), i(2, 'x') }, math), snip('DDX', '(partial <>) / (partial <>) ', { i(1, 'f'), i(2, 'x') }, math),
snip('part', 'partial ', {}, math, 1600), snip('part', 'partial ', {}, math, 1600),
-- integrals
snip('it', 'integral ', {}, math), snip('it', 'integral ', {}, math),
snip('iot', 'integral.vol ', {}, math),
snip('ift', 'integral.surf ', {}, math),
snip('int', 'integral_(<>)^(<>) ', { i(1, 'a'), i(2, 'b') }, math), snip('int', 'integral_(<>)^(<>) ', { i(1, 'a'), i(2, 'b') }, math),
snip('oit', 'integral.cont_(<>) ', { i(1, 'C') }, math), snip('oit', 'integral.cont_(<>) ', { i(1, 'C') }, math),
snip('dit', 'integral_(<>) ', { i(1, 'Omega') }, math), snip('dit', 'integral_(<>) ', { i(1, 'Omega') }, math),
-- sums
snip('sm', 'sum ', {}, math), snip('sm', 'sum ', {}, math),
snip('sum', 'sum_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'oo') }, math), snip('sum', 'sum_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'oo') }, math),
snip('dsm', 'sum_(<>) ', { i(1, 'Omega') }, math), snip('dsm', 'sum_(<>) ', { i(1, 'Omega') }, math),
-- products
snip('prd', 'product ', {}, math), snip('prd', 'product ', {}, math),
snip('prod', 'product_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'n') }, math), snip('prod', 'product_(<>)^(<>) ', { i(1, 'k=1'), i(2, 'n') }, math),
-- limits
snip('lm', 'lim ', {}, math), snip('lm', 'lim ', {}, math),
snip('lim', 'lim_(<> ->> <>) ', { i(1, 'n'), i(2, 'oo') }, math), snip('lim', 'lim_(<> ->> <>) ', { i(1, 'n'), i(2, 'oo') }, math),
snip('lim (sup|inf)', 'lim<> ', { cap(1) }, math), snip('lim (sup|inf)', 'lim<> ', { cap(1) }, math),

View File

@@ -28,18 +28,22 @@ local operations = { -- first boolean: existing brackets should be kept; second
{ 'sQ', '[', ']', false, false }, -- replace with square brackets { 'sQ', '[', ']', false, false }, -- replace with square brackets
{ 'BB', '', '', false, false }, -- remove brackets { 'BB', '', '', false, false }, -- remove brackets
{ 'ss', '"', '"', false, false }, { 'ss', '"', '"', false, false },
{ 'agl', 'lr(angle.l ', ' angle.r)', false, false }, { 'chv', 'lr(chevron.l ', ' chevron.r)', false, false },
{ 'abs', 'abs', '', true, true }, { 'abs', 'abs', '', true, true },
{ 'ul', 'underline', '', true, true }, { 'ul', 'underline', '', true, true },
{ 'ol', 'overline', '', true, true }, { 'ol', 'overline', '', true, true },
{ 'ub', 'underbrace', '', true, true }, { 'ub', 'underbrace', '', true, true },
{ 'ob', 'overbrace', '', true, true }, { 'ob', 'overbrace', '', true, true },
{ 'ht', 'hat', '', true, true }, { 'ht', 'hat', '', true, true },
{ 'ar', 'arrow', '', true, true },
{ 'br', 'macron', '', true, true }, { 'br', 'macron', '', true, true },
{ 'dt', 'dot', '', true, true }, { 'dt', 'dot', '', true, true },
{ 'dou', 'dot.double', '', true, true },
{ 'dia', 'diaer', '', true, true },
{ 'ci', 'circle', '', true, true }, { 'ci', 'circle', '', true, true },
{ 'td', 'tilde', '', true, true }, { 'td', 'tilde', '', true, true },
{ 'nr', 'norm', '', true, true }, { 'nr', 'norm', '', true, true },
{ 'arr', 'arrow', '', true, true },
{ 'vv', 'vec', '', true, true }, { 'vv', 'vec', '', true, true },
{ 'rt', 'sqrt', '', true, true }, { 'rt', 'sqrt', '', true, true },
{ 'flo', 'floor', '', true, true }, { 'flo', 'floor', '', true, true },
@@ -96,7 +100,7 @@ local smart_wrap = function(args, parent, old_state, expand)
-- normal snippet -- normal snippet
if not visual_disable_normal[trigger] then if not visual_disable_normal[trigger] then
return s(nil, { t(expand1), i(1, '1+1'), t(expand2) }) return s(nil, { t(expand1), i(1), t(expand2) })
else else
return s(nil, t(trigger)) return s(nil, t(trigger))
end end

View File

@@ -4,7 +4,7 @@ build-backend = "pdm.backend"
[project] [project]
name = "typstar" name = "typstar"
version = "1.4.1" version = "1.4.2"
description = "Neovim plugin for efficient note taking in Typst" description = "Neovim plugin for efficient note taking in Typst"
authors = [ authors = [
{ name = "arne314" } { name = "arne314" }

2
uv.lock generated
View File

@@ -516,7 +516,7 @@ wheels = [
[[package]] [[package]]
name = "typstar" name = "typstar"
version = "1.4.1" version = "1.4.2"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "aiohttp" }, { name = "aiohttp" },