This commit is contained in:
Zelong Kuang
2026-02-08 20:12:13 +11:00
parent 9941f00da2
commit 7a36bc79fc
8 changed files with 63 additions and 19 deletions

View File

@@ -15,7 +15,7 @@
(require 'init-bindings)
(require 'init-dashboard)
;; (require 'init-dashboard)
(require 'init-workspace)
(require 'init-dired)

View File

@@ -220,14 +220,6 @@
;;Quit completion before saving
(add-hook 'before-save-hook #'corfu-quit)
(advice-add #'persistent-scratch-save :before #'corfu-quit)
(defun corfu-move-to-minibuffer ()
(interactive)
(pcase completion-in-region--data
(`(,beg ,end ,table ,pred ,extras)
(let ((completion-extra-properties extras)
completion-cycle-threshold completion-cycling)
(consult-completion-in-region beg end table pred)))))
(keymap-set corfu-map "M-m" #'corfu-move-to-minibuffer)
(add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer))
(use-package nerd-icons-corfu

View File

@@ -9,7 +9,31 @@
(use-package smartparens
:hook (elpaca-after-init . smartparens-global-mode)
;; :hook (elpaca-after-init . smartparens-global-strict-mode)
:init (sp-use-paredit-bindings))
:init (sp-use-paredit-bindings)
:config
;; Autopair quotes more conservatively; if I'm next to a word/before another
;; quote, I don't want to open a new pair or it would unbalance them.
(let ((unless-list '(sp-point-before-word-p
sp-point-after-word-p
sp-point-before-same-p)))
(sp-pair "'" nil :unless unless-list)
(sp-pair "\"" nil :unless unless-list))
(dolist (brace '("(" "{" "["))
(sp-pair brace nil
:post-handlers '(("||\n[i]" "RET") ("| " "SPC"))
;; Don't autopair opening braces if before a word character or
;; other opening brace. The rationale: it interferes with manual
;; balancing of braces, and is odd form to have s-exps with no
;; whitespace in between, e.g. ()()(). Insert whitespace if
;; genuinely want to start a new form in the middle of a word.
:unless '(sp-point-before-word-p sp-point-before-same-p)))
(sp-local-pair sp-lisp-modes "(" ")" :unless '(:rem sp-point-before-same-p))
;; Don't do square-bracket space-expansion where it doesn't make sense to
(sp-local-pair '(emacs-lisp-mode org-mode markdown-mode markdown-ts-mode gfm-mode)
"[" nil :post-handlers '(:rem ("| " "SPC")))
)
;; Hungry deletion
(use-package hungry-delete

View File

@@ -1,17 +1,22 @@
;; -*- lexical-binding: t; -*-
(use-package latex
:ensure (auctex :pre-build (("./autogen.sh")
("./configure" "--without-texmf-dir" "--with-lispdir=.")
("make")))
:mode (("\\.tex\\'" . LaTeX-mode))
:hook ((LaTeX-mode . prettify-symbols-mode))
:hook prettify-symbols-mode
:hook visual-line-mode
:hook turn-on-reftex
:bind (:map LaTeX-mode-map
("C-S-e" . latex-math-from-calc))
:custom
(TeX-parse-self t)
(TeX-PDF-mode t)
(TeX-DVI-via-PDFTeX t)
:config
;; Format math as a Latex string with Calc
(add-hook 'LaTeX-mode-hook #'eglot-ensure)
(defun latex-math-from-calc ()
"Evaluate `calc' on the contents of line at point."
(interactive)
@@ -28,7 +33,14 @@
(insert (calc-eval `(,l
calc-language latex
calc-prefer-frac t
calc-angle-mode rad))))))))
calc-angle-mode rad)))))))
(setq TeX-view-program-selection '((output-pdf "PDF Tools")))
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs '((LaTeX-mode latex-mode) "texlab")))
)
(use-package cdlatex
:ensure t
:hook (LaTeX-mode . turn-on-cdlatex)

View File

@@ -16,7 +16,8 @@
`((typst-ts-mode) .
,(eglot-alternatives `(,typst-ts-lsp-download-path
"tinymist"
"typst-lsp")))))))
"typst-lsp"))))))
(setq typst-ts-preview-function 'find-file-other-window))
(use-package typst-preview
:ensure (:type git :host github :repo "havarddj/typst-preview.el")

View File

@@ -21,7 +21,7 @@
:init
(setq doom-themes-enable-bold t)
(setq doom-themes-enable-italic t)
(load-theme 'modus-operandi-tinted t))
(load-theme 'doom-moonlight t))
(use-package rainbow-delimiters
:hook ((prog-mode . rainbow-delimiters-mode)

View File

@@ -120,6 +120,16 @@
"\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
rustic-cargo-outdated-mode rustic-cargo-run-mode rustic-cargo-test-mode
"\\*haskell\\*"))
(add-to-list 'display-buffer-alist
'("\\.pdf\\'"
(display-buffer-reuse-window display-buffer-in-direction)
(direction . right)
(window-width . 0.5)))
(add-to-list 'display-buffer-alist
'("\\*OCaml\\*"
(display-buffer-reuse-window display-buffer-in-direction)
(direction . right)
(window-width . 0.5)))
:config
(with-no-warnings

View File

@@ -5,7 +5,11 @@
(use-package tabspaces
:functions tabspaces-mode
:commands (tabspaces-switch-or-create-workspace
tabspaces-open-or-create-project-and-workspace)
:hook (elpaca-after-init . tabspaces-mode)
:bind (:map tabspaces-mode-map
([remap project-switch-project] . tabspaces-open-or-create-project-and-workspace))
:custom
(tab-bar-show nil)
@@ -17,6 +21,7 @@
;; sessions
(tabspaces-session t)
(tabspaces-session-auto-restore t)
(tabspaces-keymap-prefix "C-c o"))
(tabspaces-keymap-prefix "C-c o")
(tab-bar-new-tab-choice "default"))
(provide 'init-workspace)