This commit is contained in:
Zelong Kuang
2026-04-08 15:25:39 +10:00
parent 14ecd3b17a
commit 3490e9daa9
12 changed files with 72 additions and 70 deletions

View File

@@ -1,6 +1,7 @@
;; -*- lexical-binding: t -*-
(use-package xref
:ensure nil
:init
;; Use faster search tool
(when (executable-find "rg")

View File

@@ -33,9 +33,8 @@
;; (use-package dirvish
;; :bind ("C-c o p" . dirvish-side)
;; :init (dirvish-override-dired-mode)
;; :config
;; (setq dirvish-use-header-line nil
;; dirvish-use-mode-line nil))
;; dirvish-use-mode-line nil))
(provide 'init-dired)

24
lisp/init-eaf.el Normal file
View File

@@ -0,0 +1,24 @@
;; -*- lexical-binding: t; -*-
(use-package eaf
:defer nil
:load-path "~/.emacs.d/site-lisp/emacs-application-framework/"
:custom ; See https://github.com/emacs-eaf/emacs-application-framework/wiki/Customization
(eaf-browser-continue-where-left-off t)
(eaf-browser-enable-adblocker t)
;; (browse-url-browser-function 'eaf-open-browser)
:config
(require 'eaf-pdf-viewer)
(require 'eaf-music-player)
(require 'eaf-image-viewer)
;; (defalias 'browse-web #'eaf-open-browser)
;; (eaf-bind-key scroll_up "C-n" eaf-pdf-viewer-keybinding)
;; (eaf-bind-key scroll_down "C-p" eaf-pdf-viewer-keybinding)
;; (eaf-bind-key take_photo "p" eaf-camera-keybinding)
;; (eaf-bind-key nil "M-q" eaf-browser-keybinding)
)
(provide 'init-eaf)

View File

@@ -8,42 +8,26 @@
:ensure nil
:hook elpaca-after-init)
;; (use-package smartparens
;; :diminish
;; :hook (elpaca-after-init . smartparens-global-mode)
;; :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"))))
(use-package puni
:hook (elpaca-after-init . puni-global-mode)
:bind (:map puni-mode-map
("M-s" . puni-splice)
("DEL" . my-backspace))
:init
(defun my-backspace ()
(interactive)
(if (looking-back (rx line-start (+ blank)))
(delete-region (line-beginning-position) (point))
(puni-backward-delete-char))))
;; ;; Hungry deletion
(use-package hungry-delete
:diminish
:hook (elpaca-after-init . global-hungry-delete-mode)
:init (setq hungry-delete-chars-to-skip " \t\f\v"
hungry-delete-except-modes
'(help-mode minibuffer-mode minibuffer-inactive-mode calc-mode)))
;; (use-package hungry-delete
;; :diminish
;; :hook (elpaca-after-init . global-hungry-delete-mode)
;; :init (setq hungry-delete-chars-to-skip " \t\f\v"
;; backward-delete-char-untabify-method 'all
;; hungry-delete-except-modes
;; '(help-mode minibuffer-mode minibuffer-inactive-mode calc-mode)))
(use-package abbrev
:ensure nil
@@ -62,18 +46,18 @@
:hook ((text-mode . goto-address-mode)
(prog-mode . goto-address-prog-mode)))
;; (use-package multiple-cursors
;; :hook prog-mode
;; :bind (("C-S-c C-S-c" . mc/edit-lines)
;; ("C->" . mc/mark-next-like-this)
;; ("C-<" . mc/mark-previous-like-this)
;; ("C-c C-<" . mc/mark-all-like-this)
;; ("C-M->" . mc/skip-to-next-like-this)
;; ("C-M-<" . mc/skip-to-previous-like-this)
;; ("s-<mouse-1>" . mc/add-cursor-on-click)
;; ("C-S-<mouse-1>" . mc/add-cursor-on-click)
;; :map mc/keymap
;; ("C-|" . mc/vertical-align-with-space)))
(use-package multiple-cursors
:hook elpaca-after-init
:bind (("C-S-c C-S-c" . mc/edit-lines)
("C->" . mc/mark-next-like-this)
("C-<" . mc/mark-previous-like-this)
("C-c C-<" . mc/mark-all-like-this)
("C-M->" . mc/skip-to-next-like-this)
("C-M-<" . mc/skip-to-previous-like-this)
("s-<mouse-1>" . mc/add-cursor-on-click)
("C-S-<mouse-1>" . mc/add-cursor-on-click)
:map mc/keymap
("C-|" . mc/vertical-align-with-space)))
(use-package expand-region
:bind ("C-=" . er/expand-region))

View File

@@ -39,12 +39,6 @@
(let ((load-source-file-function nil)) (load "./elpaca-autoloads"))))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
;; Install a package via the elpaca macro
;; See the "recipes" section of the manual for more details.
;; (elpaca example-package)
;; Uncomment for systems which cannot create symlinks:
(when (eq system-type 'windows-nt)
(elpaca-no-symlink-mode))
@@ -60,8 +54,6 @@
;;For example:
;;(use-package general :ensure (:wait t) :demand t)
(setq elpaca-lock-file (expand-file-name "lock-file.eld" user-emacs-directory))
(setq use-package-always-ensure t
use-package-expand-minimally t
use-package-always-defer t)

View File

@@ -1,3 +1,5 @@
;; -*- lexical-binding: t; -*-
(use-package god-mode

View File

@@ -4,6 +4,7 @@
:custom
(default-input-method "rime")
(rime-librime-root "/opt/homebrew")
(rime-emacs-module-header-root "~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/include/"))
(rime-emacs-module-header-root "~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/include/")
(rime-show-candidate 'posframe))
(provide 'init-input)

View File

@@ -3,9 +3,9 @@
(use-package gptel
:defer t
:bind (("C-c l s" . gptel-send)
("C-c l m" . gptel-menu))
("C-c l m" . gptel-menu))
:config
(setq gptel-model 'claude-sonnet-4.5)
(setq gptel-model 'gpt-5.2-codex)
(setq gptel-backend (gptel-make-gh-copilot "Copilot"))
(setq gptel-default-mode #'org-mode)
(setq gptel-display-buffer-action nil) ; if user changes this, popup manager will bow out

View File

@@ -265,7 +265,7 @@ the element after the #+HEADER: tag."
(lambda () (org-latex-preview '(16))))))
;; Add margin and rescale display math
(defvar my/org-latex-display-math-scale 1)
(defvar my/org-latex-display-math-margin 8)
(defvar my/org-latex-display-math-margin 5)
(defun my/org-latex-preview-add-margin-advice (ov _path-info)
(save-excursion
(goto-char (overlay-start ov))

View File

@@ -1,22 +1,17 @@
;; -*- lexical-binding: t;-*-
(use-package typst-ts-mode
:ensure (:type git :host codeberg :repo "meow_king/typst-ts-mode")
:hook (typst-ts-mode . lsp-deferred)
: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
;; (typst-ts-watch-options "--open")
(setq typst-ts-mode-grammar-location (expand-file-name "tree-sitter/libtree-sitter-typst.so" user-emacs-directory))
(setq typst-ts-mode-enable-raw-blocks-highlight t)
(keymap-set typst-ts-mode-map "C-c C-c" #'typst-ts-tmenu)
(setq typst-ts-preview-function 'find-file-other-window))
(use-package typst-preview
:ensure (:type git :host github :repo "havarddj/typst-preview.el")
: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'.
@@ -25,6 +20,8 @@
(typst-preview-partial-rendering t) ; enable partial rendering
:config
(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
(define-key typst-ts-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))