Typst support

This commit is contained in:
Zelong Kuang
2025-11-16 19:12:34 +11:00
parent e10f36500a
commit a9820fe57b
4 changed files with 64 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
(setq doom-font (font-spec :family "Maple Mono" :size 20)) (setq doom-font (font-spec :family "Maple Mono" :size 20))
(add-to-list 'default-frame-alist '(height . 53)) (add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 120)) (add-to-list 'default-frame-alist '(width . 120))
(setq doom-theme 'doom-one) (setq doom-theme 'doom-vibrant)
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(setq org-directory "~/org/") (setq org-directory "~/org/")
@@ -34,3 +34,19 @@
(add-to-list 'copilot-indentation-alist '(text-mode 2)) (add-to-list 'copilot-indentation-alist '(text-mode 2))
(add-to-list 'copilot-indentation-alist '(clojure-mode 2)) (add-to-list 'copilot-indentation-alist '(clojure-mode 2))
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2))) (add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2)))
(use-package! 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))
(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"
"typst-lsp"))))))

View File

@@ -4,7 +4,7 @@
(setq doom-font (font-spec :family "Maple Mono" :size 20)) (setq doom-font (font-spec :family "Maple Mono" :size 20))
(add-to-list 'default-frame-alist '(height . 53)) (add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 120)) (add-to-list 'default-frame-alist '(width . 120))
(setq doom-theme 'doom-one) (setq doom-theme 'doom-vibrant)
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(setq org-directory "~/org/") (setq org-directory "~/org/")
#+end_src #+end_src
@@ -68,3 +68,31 @@ Configuration
(add-to-list 'copilot-indentation-alist '(clojure-mode 2)) (add-to-list 'copilot-indentation-alist '(clojure-mode 2))
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2))) (add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2)))
#+end_src #+end_src
** Lang
*** Typst
**** Tree-sitter
#+begin_src emacs-lisp :tangle packages.el
(package! typst-ts-mode :recipe (:host codeberg :repo "meow_king/typst-ts-mode"))
#+end_src
#+begin_src emacs-lisp
(use-package! 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))
#+end_src
**** Tinymist (lsp)
#+begin_src emacs-lisp
(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"
"typst-lsp"))))))
#+end_src

16
custom.el Normal file
View File

@@ -0,0 +1,16 @@
;;; -*- lexical-binding: t -*-
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("7c3d62a64bafb2cc95cd2de70f7e4446de85e40098ad314ba2291fc07501b70c"
"0325a6b5eea7e5febae709dab35ec8648908af12cf2d2b569bedc8da0a3a81c1"
"3f24dd8f542f4aa8186a41d5770eb383f446d7228cd7a3413b9f5e0ec0d5f3c0" default)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@@ -10,3 +10,5 @@
(package! copilot (package! copilot
:recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el"))) :recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el")))
(package! typst-ts-mode :recipe (:host codeberg :repo "meow_king/typst-ts-mode"))