mirror of
https://github.com/Ascyii/typstar.git
synced 2026-03-02 01:22:43 +01:00
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,4 +3,5 @@
|
|||||||
|
|
||||||
.obsidian
|
.obsidian
|
||||||
assets
|
assets
|
||||||
|
result
|
||||||
|
|
||||||
|
|||||||
18
flake.lock
generated
18
flake.lock
generated
@@ -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
133
flake.nix
@@ -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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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),
|
||||||
@@ -34,27 +35,28 @@ return {
|
|||||||
snip('ge', '>>= ', {}, math),
|
snip('ge', '>>= ', {}, math),
|
||||||
|
|
||||||
-- operators
|
-- operators
|
||||||
snip('ak([^k ])', '+ <>', { cap(1) }, math, 100, { wordTrig = false }),
|
|
||||||
snip('sk([^k ])', '- <>', { cap(1) }, math, 100, { wordTrig = false }),
|
|
||||||
snip('oak', 'plus.circle ', {}, math),
|
|
||||||
snip('bak', 'plus.square ', {}, math),
|
|
||||||
snip('mak', 'plus.minus ', {}, math),
|
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('xx', 'times ', {}, math),
|
||||||
snip('oxx', 'times.circle ', {}, math),
|
snip('oxx', 'times.o ', {}, math),
|
||||||
snip('bxx', 'times.square ', {}, math),
|
snip('bxx', 'times.square ', {}, math),
|
||||||
snip('ff', '(<>) / (<>) <>', { i(1, 'a'), i(2, 'b'), i(3) }, 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('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 +69,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('nab', 'nabla ', {}, math),
|
||||||
|
snip('ep', 'exp(<>) ', { 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, {
|
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('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),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ 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 },
|
||||||
@@ -37,9 +37,11 @@ local operations = { -- first boolean: existing brackets should be kept; second
|
|||||||
{ 'ht', 'hat', '', true, true },
|
{ 'ht', 'hat', '', true, true },
|
||||||
{ 'br', 'macron', '', true, true },
|
{ 'br', 'macron', '', true, true },
|
||||||
{ 'dt', 'dot', '', true, true },
|
{ 'dt', 'dot', '', 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 },
|
||||||
|
|||||||
@@ -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" }
|
||||||
|
|||||||
Reference in New Issue
Block a user