Files
doom/config.el

198 lines
8.1 KiB
EmacsLisp
Raw Normal View History

(use-package! benchmark-init
:ensure t
:config
;; To disable collection of benchmark data after init is done.
(add-hook 'after-init-hook 'benchmark-init/deactivate))
(setf meow-expand-hint-remove-delay 0)
2025-11-22 00:22:58 +11:00
(pcase system-type
('darwin ; macOS
(setq doom-font (font-spec :family "Maple Mono" :size 20))
(add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 120)))
('gnu/linux ; Linux (including Debian)
2025-12-04 23:01:56 +11:00
(setq doom-font (font-spec :family "Maple Mono" :size 24)) ; 20 * 1.5
(add-to-list 'default-frame-alist '(height . 40))
2025-11-22 00:22:58 +11:00
(add-to-list 'default-frame-alist '(width . 100))))
2025-12-04 23:01:56 +11:00
2025-11-17 20:44:54 +11:00
(setq catppuccin-flavor 'catppuccin)
(setq doom-theme 'doom-material-dark)
2025-11-16 15:47:31 +11:00
(setq display-line-numbers-type 'relative)
(setq org-directory "~/org/")
;; (use-package! ef-themes
;; :ensure t
;; :init
;; ;; This makes the Modus commands listed below consider only the Ef
;; ;; themes. For an alternative that includes Modus and all
;; ;; derivative themes (like Ef), enable the
;; ;; `modus-themes-include-derivatives-mode' instead. The manual of
;; ;; the Ef themes has a section that explains all the possibilities:
;; ;;
;; ;; - Evaluate `(info "(ef-themes) Working with other Modus themes or taking over Modus")'
;; ;; - Visit <https://protesilaos.com/emacs/ef-themes#h:6585235a-5219-4f78-9dd5-6a64d87d1b6e>
;; (ef-themes-take-over-modus-themes-mode 1)
;; :bind
;; (("<f5>" . modus-themes-rotate)
;; ("C-<f5>" . modus-themes-select)
;; ("M-<f5>" . modus-themes-load-random))
;; :config
;; ;; All customisations here.
;; (setq modus-themes-mixed-fonts t)
;; (setq modus-themes-italic-constructs t)
;; ;; ;; Finally, load your theme of choice (or a random one with
;; ;; ;; `modus-themes-load-random', `modus-themes-load-random-dark',
;; ;; ;; `modus-themes-load-random-light').
;; ;; (modus-themes-load-theme 'ef-light)
;; )
2025-11-16 22:05:10 +11:00
(use-package! yasnippet
2025-11-17 20:44:54 +11:00
:config
(defun my-yas-try-expanding-auto-snippets ()
(when yas-minor-mode
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
(yas-expand))))
(add-hook 'post-command-hook #'my-yas-try-expanding-auto-snippets)
)
2025-11-16 15:47:31 +11:00
(use-package! rainbow-delimiters
:hook ((prog-mode . rainbow-delimiters-mode)
(typst-ts-mode . rainbow-delimiters-mode)
(foo-mode . rainbow-delimiters-mode)))
(use-package! gptel
:config
(setq! gptel-api-key "e994f45f9b46cc8608bd2e9cd508417255514e96913b1764aab612512aa66449")
(setq gptel-model 'claude-sonnet-4.5)
(setq gptel-backend (gptel-make-gh-copilot "Copilot"))
)
(map! :map meow-normal-state-keymap
:leader "w l" 'centaur-tabs-forward)
(map! :map meow-normal-state-keymap
:leader "w h" 'centaur-tabs-backward)
2025-11-16 19:12:34 +11:00
(use-package! typst-ts-mode
2025-11-17 20:44:54 +11:00
:init
(add-hook 'typst-ts-mode-hook #'eglot-ensure)
: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))
2025-11-16 19:12:34 +11:00
(with-eval-after-load 'eglot
2025-11-17 20:44:54 +11:00
(with-eval-after-load 'typst-ts-mode
(add-to-list 'eglot-server-programs
`((typst-ts-mode) .
,(eglot-alternatives `(,"tinymist"
"typst-lsp"))))))
2025-11-16 20:05:31 +11:00
(use-package! websocket)
(use-package! typst-preview
2025-11-17 20:44:54 +11:00
;; :load-path "path/to/typst-preview.el" ;; if installed manually
: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-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)
)
(use-package org-latex-preview
:hook ((org-mode . org-latex-preview-mode)
(org-latex-preview-mode . org-latex-preview-center-mode))
2025-11-17 20:44:54 +11:00
:config
;; Increase preview width
;; (plist-put org-latex-preview-appearance-options
;; :page-width 0.8)
2025-11-17 20:44:54 +11:00
;; ;; Enable consistent equation numbering
(setq org-latex-preview-numbered t)
;; Bonus: Turn on live previews. This shows you a live preview of a LaTeX
;; fragment and updates the preview in real-time as you edit it.
;; To preview only environments, set it to '(block edit-special) instead
(setq org-latex-preview-mode-display-live t)
;; More immediate live-previews -- the default delay is 1 second
(setq org-latex-preview-mode-update-delay 0)
;; code for centering LaTeX previews -- a terrible idea
2025-11-17 20:44:54 +11:00
(defun my/org-latex-preview-uncenter (ov)
(overlay-put ov 'before-string nil))
(defun my/org-latex-preview-recenter (ov)
(overlay-put ov 'before-string (overlay-get ov 'justify)))
(defun my/org-latex-preview-center (ov)
(save-excursion
(goto-char (overlay-start ov))
(when-let* ((elem (org-element-context))
((or (eq (org-element-type elem) 'latex-environment)
(string-match-p "^\\\\\\[" (org-element-property :value elem))))
(img (overlay-get ov 'display))
(prop `(space :align-to (- center (0.55 . ,img))))
(justify (propertize " " 'display prop 'face 'default)))
(overlay-put ov 'justify justify)
(overlay-put ov 'before-string (overlay-get ov 'justify)))))
(define-minor-mode org-latex-preview-center-mode
"Center equations previewed with `org-latex-preview'."
:global nil
(if org-latex-preview-center-mode
(progn
(add-hook 'org-latex-preview-overlay-open-functions
#'my/org-latex-preview-uncenter nil :local)
(add-hook 'org-latex-preview-overlay-close-functions
#'my/org-latex-preview-recenter nil :local)
(add-hook 'org-latex-preview-overlay-update-functions
#'my/org-latex-preview-center nil :local))
(remove-hook 'org-latex-preview-overlay-close-functions
#'my/org-latex-preview-recenter)
(remove-hook 'org-latex-preview-overlay-update-functions
#'my/org-latex-preview-center)
(remove-hook 'org-latex-preview-overlay-open-functions
#'my/org-latex-preview-uncenter)))
)
(add-to-list 'org-modules 'org-habit)
(use-package! org-modern
:config
(setq org-modern-table nil))
(setq org-capture-templates
'(("t" "Personal todo" entry (file+headline +org-capture-todo-file "Inbox")
"* TODO %?\n%i\n%a" :prepend t)
("n" "Personal notes" entry (file+headline +org-capture-notes-file "Inbox")
"* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry (file+olp+datetree +org-capture-journal-file)
"* %U %?\n%i\n%a" :prepend t)
("p" "Templates for projects")
("pt" "Project-local todo" entry
(file+headline +org-capture-project-todo-file "Inbox") "* TODO %?\n%i\n%a"
:prepend t)
("pn" "Project-local notes" entry
(file+headline +org-capture-project-notes-file "Inbox") "* %U %?\n%i\n%a"
:prepend t)
("pc" "Project-local changelog" entry
(file+headline +org-capture-project-changelog-file "Unreleased")
"* %U %?\n%i\n%a" :prepend t)
("o" "Centralized templates for projects")
("ot" "Project todo" entry #'+org-capture-central-project-todo-file
"* TODO %?\n %i\n %a" :heading "Tasks" :prepend nil)
("on" "Project notes" entry #'+org-capture-central-project-notes-file
"* %U %?\n %i\n %a" :heading "Notes" :prepend t)
("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file
"* %U %?\n %i\n %a" :heading "Changelog" :prepend t))
)