2025-12-14 19:35:07 +11:00
|
|
|
;; -*- lexical-binding: t;-*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package typst-ts-mode
|
2026-03-29 19:12:45 +11:00
|
|
|
:straight (:type git :host codeberg :repo "meow_king/typst-ts-mode")
|
2025-12-15 18:20:19 +11:00
|
|
|
:hook (typst-ts-mode . eglot-ensure)
|
2025-12-14 19:35:07 +11:00
|
|
|
: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
|
2025-12-15 18:20:19 +11:00
|
|
|
(keymap-set typst-ts-mode-map "C-c C-c" #'typst-ts-tmenu)
|
|
|
|
|
(with-eval-after-load 'eglot
|
|
|
|
|
(with-eval-after-load 'typst-ts-mode
|
|
|
|
|
(add-to-list 'eglot-server-programs
|
|
|
|
|
`((typst-ts-mode) .
|
|
|
|
|
,(eglot-alternatives `(,typst-ts-lsp-download-path
|
|
|
|
|
"tinymist"
|
2026-02-08 20:12:13 +11:00
|
|
|
"typst-lsp"))))))
|
|
|
|
|
(setq typst-ts-preview-function 'find-file-other-window))
|
2025-12-14 19:35:07 +11:00
|
|
|
|
|
|
|
|
(use-package typst-preview
|
2026-03-29 19:12:45 +11:00
|
|
|
:straight (:type git :host github :repo "havarddj/typst-preview.el")
|
2025-12-15 18:20:19 +11:00
|
|
|
:init
|
2025-12-14 19:35:07 +11:00
|
|
|
(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)
|
2025-12-15 18:20:19 +11:00
|
|
|
(define-key typst-ts-mode-map (kbd "C-c C-l") #'typst-preview-mode))
|
|
|
|
|
|
|
|
|
|
|
2025-12-14 19:35:07 +11:00
|
|
|
|
2025-12-14 19:36:44 +11:00
|
|
|
(provide 'init-typst)
|