Files
.emacs.d/lisp/init-package.el
andsy10 b4733718d4 refactor: Reorganize config with use-package and optimize startup hooks
- Split monolithic init-package.el into focused modules
- Convert eager `:init` blocks to lazy `:hook`
- Consolidate UI settings and defer theme loading.
- Remove duplicated config between GUI and terminal paths.
2026-06-04 02:27:20 +08:00

166 lines
4.5 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;;; init-package.el --- some other packages -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
;; keycast按键广播
(use-package keycast)
;; anzu显示isearch匹配数字
(use-package anzu
:delight
:hook
(after-init . global-anzu-mode))
;; wgrepwritable grep
(use-package wgrep)
;; ripgrep
(use-package rg)
;; hydra
(use-package hydra
:defines
(consult-imenu-config)
:init
(with-eval-after-load 'consult-imenu
(setq consult-imenu-config
'((emacs-lisp-mode :toplevel "Functions"
:types ((?f "Functions" font-lock-function-name-face)
(?h "Hydras" font-lock-constant-face)
(?m "Macros" font-lock-function-name-face)
(?p "Packages" font-lock-constant-face)
(?t "Types" font-lock-type-face)
(?v "Variables" font-lock-variable-name-face)))))))
;; jinx拼写检查
(use-package jinx
:if
(not *is-windows*)
:delight
(jinx-mode " Jinx" jinx)
:bind
([remap ispell-word] . jinx-correct)
:config
(setq jinx-languages "en_US")
(add-to-list 'jinx-exclude-regexps '(t "\\cc"))
(with-eval-after-load 'jinx
(dolist (range '((#x4E00 . #x9FFF)
(#x3400 . #x4DBF)
(#x3000 . #x303F)
(#xFF00 . #xFFEF)
(#x20000 . #x2A6DF)))
(let ((start (car range))
(end (cdr range)))
(dotimes (i (- end start))
(modify-syntax-entry (+ start i) "_" jinx--syntax-table))))))
(use-package consult-jinx
:if
(not *is-windows*)
:after jinx
:demand t
:straight nil)
;; eat终端
(use-package eat
:if
(not *is-windows*)
:straight
(eat :type git
:host codeberg
:repo "akib/emacs-eat"
:files ("*.el"
("term" "term/*.el")
"*.texi"
"*.ti"
("terminfo/e" "terminfo/e/*")
("terminfo/65" "terminfo/65/*")
("integration" "integration/*")
(:exclude ".dir-locals.el" "*-tests.el")))
:hook
((eshell-load . eat-eshell-mode)
(eshell-load . eat-eshell-visual-command-mode))
:config
(setq eat-term-terminfo-directory eat--terminfo-path))
;; perspective工作区管理
(use-package perspective
:bind
("C-x M-b" . persp-list-buffers)
:custom
(persp-mode-prefix-key (kbd "C-c p"))
:hook
(after-init . persp-mode)
:config
(setq persp-switch-to-buffer-behavior 'switch)
(with-eval-after-load 'consult
(consult-customize consult-source-buffer :hidden t :default nil)
(add-to-list 'consult-buffer-sources persp-consult-source))
(setq switch-to-prev-buffer-skip
(lambda (win buff bury-or-kill)
(or (not (persp-is-current-buffer buff))
(cl-some (lambda (re) (string-match-p re (buffer-name buff)))
consult-buffer-filter))))
(setq persp-initial-frame-name "main"))
;; magit
(use-package magit
:config
(setq magit-bind-magit-project-status nil
magit-diff-refine-hunk 'all))
;; git-timemachine
(use-package git-timemachine)
;; ediff
(use-package ediff
:config
(setq ediff-window-setup-function 'ediff-setup-windows-plain
ediff-split-window-function 'split-window-horizontally))
;; project
(use-package project
:config
(setq project-switch-commands (assq-delete-all 'project-vc-dir project-switch-commands))
(setq project-switch-commands
(seq-uniq (append project-switch-commands
'((magit-project-status "Magit" ?v)
(eat-project "Eat" ?E)
(project-query-replace-regexp "Query Replace" ?R)
(consult-ripgrep-project "Ripgrep" ?r))))))
;; emms
(use-package emms
:commands
(emms-playlist-mode-switch-buffer)
:config
(emms-all)
(setq emms-player-list '(emms-player-mpv)
emms-info-functions '(emms-info-native))
(emms-history-load))
;; tokei
(use-package tokei)
;; helpful
(use-package helpful
:bind
(([remap describe-function] . helpful-callable)
([remap describe-command] . helpful-command)
([remap describe-variable] . helpful-variable)
([remap describe-key] . helpful-key)
([remap describe-symbol] . helpful-symbol)
:map emacs-lisp-mode-map
("C-c C-d C-d" . helpful-at-point)
:map lisp-interaction-mode-map
("C-c C-d C-d" . helpful-at-point)
:map helpful-mode-map
("C-x K" . helpful-kill-buffers)
("r" . remove-hook-at-point)))
(provide 'init-package)
;;; init-package.el ends here