From 3040b52daeed370299590454ff8672e0af3bb6e5 Mon Sep 17 00:00:00 2001 From: Zelong Kuang Date: Sun, 14 Dec 2025 19:35:07 +1100 Subject: [PATCH] Add typst support --- lisp/init-typst.el | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lisp/init-typst.el diff --git a/lisp/init-typst.el b/lisp/init-typst.el new file mode 100644 index 0000000..3bcc6e5 --- /dev/null +++ b/lisp/init-typst.el @@ -0,0 +1,30 @@ +;; -*- lexical-binding: t;-*- + + +(use-package typst-ts-mode + :ensure (:type git :host codeberg :repo "meow_king/typst-ts-mode") + :custom + ;; (typst-ts-watch-options "--open") + (typst-ts-mode-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory)) + (typst-ts-mode-enable-raw-blocks-highlight t) + :config + (keymap-set typst-ts-mode-map "C-c C-c" #'typst-ts-tmenu)) + +(use-package typst-preview + :ensure (:type git :host github :repo "havarddj/typst-preview.el") + :init + (setq typst-preview-autostart t) ; start preview automatically when typst-preview-mode is activated + (setq typst-preview-open-browser-automatically t) ; open browser automatically when typst-preview-start is run + + :custom + (typst-preview-browser "default") ; this is the default option; other options are `eaf-browser' or `xwidget'. + (typst-preview-invert-colors "auto") ; invert colors depending on system theme + (typst-preview-executable "tinymist") ; path to tinymist binary (relative or absolute) + (typst-preview-partial-rendering t) ; enable partial rendering + + :config + (define-key typst-ts-mode-map (kbd "C-c C-j") 'typst-preview-send-position) + (define-key typst-ts-mode-map (kbd "C-c C-l") #'typst-preview-mode) + ) + +(provode 'init-typst)