This commit is contained in:
Zelong Kuang
2025-11-16 22:05:10 +11:00
parent 8a7a911295
commit 506025930b
7 changed files with 151 additions and 119 deletions

View File

@@ -1,19 +1,21 @@
(setq-default tab-width 4)
(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 catppuccin-flavor 'mocha)
(setq doom-theme 'catppuccin) (setq doom-theme 'catppuccin)
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(setq org-directory "~/org/") (setq org-directory "~/org/")
(setq catppuccin-flavor 'mocha) (use-package! yasnippet
(catppuccin-reload) :config
(after! yasnippet
(defun my-yas-try-expanding-auto-snippets () (defun my-yas-try-expanding-auto-snippets ()
(when yas-minor-mode (when yas-minor-mode
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto))) (let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
(yas-expand)))) (yas-expand))))
(add-hook 'post-command-hook #'my-yas-try-expanding-auto-snippets)) (add-hook 'post-command-hook #'my-yas-try-expanding-auto-snippets)
)
;; accept completion from copilot and fallback to company ;; accept completion from copilot and fallback to company
(use-package! copilot (use-package! copilot
@@ -34,6 +36,8 @@
(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 (use-package! typst-ts-mode
:init
(add-hook 'typst-ts-mode-hook #'eglot-ensure)
:custom :custom
;; (typst-ts-watch-options "--open") ;; (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-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory))
@@ -45,8 +49,7 @@
(with-eval-after-load 'typst-ts-mode (with-eval-after-load 'typst-ts-mode
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
`((typst-ts-mode) . `((typst-ts-mode) .
,(eglot-alternatives `(,typst-ts-lsp-download-path ,(eglot-alternatives `(,"tinymist"
"tinymist"
"typst-lsp")))))) "typst-lsp"))))))
(use-package! websocket) (use-package! websocket)

View File

@@ -1,35 +1,37 @@
* My doom config * My doom config
** Some tweak
*** change indent size
#+begin_src emacs-lisp
(setq-default tab-width 4)
#+end_src
** Appearance settings ** Appearance settings
#+begin_src emacs-lisp #+begin_src emacs-lisp
(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 catppuccin-flavor 'mocha)
(setq doom-theme 'catppuccin) (setq doom-theme 'catppuccin)
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
(setq org-directory "~/org/") (setq org-directory "~/org/")
#+end_src #+end_src
*** Themes *** Themes
Catppuccin **** Catppuccin
#+begin_src emacs-lisp :tangle packages.el #+begin_src emacs-lisp :tangle packages.el
(package! catppuccin-theme) (package! catppuccin-theme)
#+end_src #+end_src
#+begin_src emacs-lisp
(setq catppuccin-flavor 'mocha)
(catppuccin-reload)
#+end_src
** Plugins ** Plugins
*** Yasnippet *** Yasnippet
This enables the feature of auto-expanding snippets when matching the pattern This enables the feature of auto-expanding snippets when matching the pattern
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! yasnippet (use-package! yasnippet
:config
(defun my-yas-try-expanding-auto-snippets () (defun my-yas-try-expanding-auto-snippets ()
(when yas-minor-mode (when yas-minor-mode
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto))) (let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
(yas-expand)))) (yas-expand))))
(add-hook 'post-command-hook #'my-yas-try-expanding-auto-snippets)) (add-hook 'post-command-hook #'my-yas-try-expanding-auto-snippets)
)
#+end_src #+end_src
*** Eat (deprecated) *** Eat (deprecated)
@@ -89,6 +91,8 @@ Configuration
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! typst-ts-mode (use-package! typst-ts-mode
:init
(add-hook 'typst-ts-mode-hook #'eglot-ensure)
:custom :custom
;; (typst-ts-watch-options "--open") ;; (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-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory))
@@ -103,8 +107,7 @@ Configuration
(with-eval-after-load 'typst-ts-mode (with-eval-after-load 'typst-ts-mode
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
`((typst-ts-mode) . `((typst-ts-mode) .
,(eglot-alternatives `(,typst-ts-lsp-download-path ,(eglot-alternatives `(,"tinymist"
"tinymist"
"typst-lsp")))))) "typst-lsp"))))))
#+end_src #+end_src
@@ -133,3 +136,6 @@ Configuration
(define-key typst-preview-mode-map (kbd "C-c C-j") 'typst-preview-send-position) (define-key typst-preview-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)) (define-key typst-ts-mode-map (kbd "C-c C-l") #'typst-preview-mode))
#+end_src #+end_src
#+RESULTS:
: t

12
init.el
View File

@@ -21,11 +21,11 @@
;;layout ; auie,ctsrnm is the superior home row ;;layout ; auie,ctsrnm is the superior home row
:completion :completion
;;company ; the ultimate code completion backend ;;company ; the ultimate code completion backend
(corfu +orderless) ; complete with cap(f), cape and a flying feather! (corfu +icons +orderless) ; complete with cap(f), cape and a flying feather!
;;helm ; the *other* search engine for love and life ;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine... ;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life ;;ivy ; a search engine for love and life
vertico ; the search engine of the future (vertico +icons + childframe) ; the search engine of the future
:ui :ui
;;deft ; notational velocity for Emacs ;;deft ; notational velocity for Emacs
@@ -56,10 +56,10 @@
(evil +everywhere); come to the dark side, we have cookies (evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness (format +onsave +lsp) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim ;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent ;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of ;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates ;;rotate-text ; cycle region at point between text candidates
@@ -99,7 +99,7 @@
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean... ;;llm ; when I said you needed friends, I didn't mean...
(lsp +eglot +peek) ; M-x vscode (lsp +eglot +peek +booster) ; M-x vscode
magit ; a git porcelain for Emacs magit ; a git porcelain for Emacs
make ; run make tasks from Emacs make ; run make tasks from Emacs
;;pass ; password manager for nerds ;;pass ; password manager for nerds
@@ -148,7 +148,7 @@
;;javascript ; all(hope(abandon(ye(who(enter(here)))))) ;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB ;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script) ;;kotlin ; a better, slicker Java(Script)
latex ; writing papers in Emacs has never been so fun (latex +cdlatex +lsp +fold) ; writing papers in Emacs has never been so fun
lean ; for folks with too much to prove lean ; for folks with too much to prove
;;ledger ; be audit you can be ;;ledger ; be audit you can be
;; lua ; one-based indices? one-based indices ;; lua ; one-based indices? one-based indices

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: display math
# key: dm
# condition: (and (not (texmathp)) (quote auto))
# group: math
# --
\$ $0 \$

View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: inline math
# key: mk
# condition: (and (not (texmathp)) (quote auto))
# group: math
# --
\$$0\$

View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Theorem
# key: #thm
# condition: (and (not (texmathp)) (quote auto))
# group: math
# --
#theorem()[
$0
]