mirror of
https://github.com/Ascyii/typstar.git
synced 2025-12-31 21:14:25 -05:00
eb443cabff84faa8e74b789985145ac5a956e82f
Typstar
Neovim plugin for efficient note taking in typst
Features
- Powerful autosnippets using LuaSnip and Tree-sitter (inspired by fastex.nvim)
- Easy insertion of drawings using Obsidian Excalidraw
- [WIP] Export of Anki flashcards
Usage
Snippets
Use :TypstarToggleSnippets to toggle all snippets at any time.
Available snippets can mostly be intuitively derived from here, they include:
- Alphanumeric characters:
:<char>→$<char>$in markup (e.g.:X→$X$,:5→$5$) - Greek letters:
;<latin>→<greek>in math and$<greek>$in markup (e.g.;a→alpha/$alpha$) - Common indices (numbers and letters
i-m):<letter><index>→<letter>_<index>in math and$<letter>$<index>→$<letter>_<index>$in markup (e.gA314→A_314,$alpha$n→$alpha_n$) - Wrapping of any mathematical expression (see operations, works nested, multiline and in visual mode via the selection key):
<expression><operation>→<operation>(<expression>)(e.g.(a^2+b^2)rt→sqrt(a^2+b^2),lambdatd→tilde(lambda),(1+1)sQ→[1+1],(1+1)sq→[(1+1)]) - Matrices:
<size>maand<size>lma(e.g.23ma→ 2x3 matrix) - ctheorems shorthands (e.g.
tem→ empty theorem,exa→ empty example) - Many shorthands for mathematical expressions
Note that you can enable and disable collections of snippets in the config.
Excalidraw
Use :TypstarInsertExcalidraw to create a new drawing using the configured template, insert a figure displaying it and open it in Obsidian.
To open an inserted drawing in Obsidian, simply run :TypstarOpenExcalidraw while your cursor is on a line referencing the drawing.
Anki
WIP
Installation
Install the plugin in neovim and set the typstarRoot config or alternatively clone typstar into ~/typstar.
require('typstar').setup({
typstarRoot = '/path/to/typstar/repo' -- depending on your nvim plugin system
})
Snippets
- Install LuaSnip, set
enable_autosnippets = trueand set a visual mode selection key (e.g.store_selection_keys = '<Tab>') in the configuration - Install jsregexp as described here (running
:lua require('jsregexp')in nvim should not result in an error) - Install nvim-treesitter and run
:TSInstall typst - Optional: Setup ctheorems with names like here
Excalidraw
- Install Obsidian and create a vault in your typst note taking directory
- Install the obsidian-excalidraw-plugin and enable
Auto-export SVG(in plugin settings atEmbedding Excalidraw into your Notes and Exporting > Export Settings > Auto-export Settings) - Have the
xdg-opencommand working or set a different command aturiOpenCommandin the config
Anki
WIP
Configuration
Configuration options can be intuitively derived from the table here.
Description
Languages
Lua
63.2%
Python
32.7%
Nix
4.1%