Files
.emacs.d/lisp/init-ui.el

220 lines
6.9 KiB
EmacsLisp
Raw Normal View History

2025-12-14 04:51:24 +11:00
;; -*- lexical-binding: t -*-
2025-12-22 10:51:46 +11:00
;; (setq idle-update-delay 1.0)
2025-12-14 04:51:24 +11:00
2026-02-22 05:49:18 +11:00
;; (setq-default line-height 0.16)
;; (setq-local default-text-properties '(line-spacing 0.1 line-height 1.1))
2026-03-14 19:46:30 +11:00
2026-03-29 19:12:45 +11:00
(use-package diminish)
2026-03-14 19:46:30 +11:00
2025-12-14 04:51:24 +11:00
(setq-default cursor-in-non-selected-windows nil)
(setq highlight-nonselected-windows nil)
(setq fast-but-imprecise-scrolling t)
(setq redisplay-skip-fontification-on-input t)
2026-04-02 13:27:43 +11:00
(setq frame-resize-pixelwise t)
2025-12-14 04:51:24 +11:00
2026-02-27 02:32:57 +11:00
;; 隐藏 title bar
2026-03-29 19:12:45 +11:00
(add-to-list 'default-frame-alist '(undecorated-round . t))
2026-02-27 02:32:57 +11:00
2025-12-14 04:51:24 +11:00
(use-package solaire-mode
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . solaire-global-mode))
2026-02-20 03:16:08 +11:00
2026-02-21 08:47:38 +11:00
(use-package modus-themes
2025-12-22 14:48:37 +11:00
:init
2026-02-21 08:47:38 +11:00
(setq modus-themes-italic-constructs t
2026-02-22 04:38:13 +11:00
modus-themes-bold-constructs t
2026-04-03 00:22:19 +11:00
modus-themes-mixed-fonts t)
:commands (modus-themes-load-random-dark
modus-themes-load-random-light
modus-themes-load-random))
2025-12-14 04:51:24 +11:00
2026-03-20 00:44:25 +11:00
(use-package doric-themes
2026-04-03 00:22:19 +11:00
;; :bind ("<f5>" . doric-themes-load-random)
;; :bind ("C-<f5>" . (lambda () (interactive) (doric-themes-load-random 'light)))
;; :bind ("M-<f5>" . (lambda () (interactive) (doric-themes-load-random 'dark)))
:commands doric-themes-load-random)
(use-package ef-themes
:bind ("<f5>" . modus-themes-load-random)
:bind ("C-<f5>" . modus-themes-load-random-light)
:bind ("M-<f5>" . modus-themes-load-random-dark)
: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))
2026-03-20 00:44:25 +11:00
2026-04-02 13:27:43 +11:00
(use-package auto-dark
:ensure t
;; :custom
;; (auto-dark-themes '((doric-beach) (leuven)))
;; (auto-dark-allow-osascript t)
;; (auto-dark-detection-method nil) ;; dangerous to be set manually
:hook
(auto-dark-dark-mode
. (lambda ()
;; something to execute when dark mode is detected
2026-04-03 00:22:19 +11:00
;; (doric-themes-load-random 'dark))
(modus-themes-load-random-dark)
2026-04-03 15:54:22 +11:00
))
2026-04-02 13:27:43 +11:00
(auto-dark-light-mode
. (lambda ()
;; something to execute when light mode is detected
2026-04-03 00:22:19 +11:00
;; (doric-themes-load-random 'light)
(modus-themes-load-random-light)
2026-04-02 13:27:43 +11:00
))
2026-04-02 19:21:30 +11:00
:hook elpaca-after-init)
2026-04-02 13:27:43 +11:00
2025-12-14 04:51:24 +11:00
(use-package rainbow-delimiters
2026-03-20 00:44:25 +11:00
:hook ((prog-mode . rainbow-delimiters-mode)
(typst-ts-mode . rainbow-delimiters-mode)
(python-ts-mode . rainbow-delimiters-mode)))
2026-02-21 08:47:38 +11:00
(use-package rainbow-mode
2026-03-22 23:57:48 +11:00
:hook text-mode
:hook prog-mode)
2026-03-14 11:42:48 +11:00
(use-package mood-line
:hook emacs-startup)
;; (use-package doom-modeline
2026-04-02 19:21:30 +11:00
;; :hook (elpaca-after-init . doom-modeline-mode)
;; :config
;; (setq doom-modeline-support-imenu t
;; doom-modeline-height 30
;; doom-modeline-buffer-file-name-style 'relative-from-project
;; doom-modeline-enable-word-count t
;; ;; doom-modeline-project-name t
;; doom-modeline-check 'simple
;; doom-modeline-buffer-encoding nil
;; doom-modeline-major-mode-icon nil))
2025-12-14 04:51:24 +11:00
(use-package hide-mode-line
:autoload turn-off-hide-mode-line-mode
:hook (((eat-mode
eshell-mode shell-mode
term-mode vterm-mode
embark-collect-mode lsp-ui-imenu-mode
pdf-annot-list-mode) . turn-on-hide-mode-line-mode)))
(unless (daemonp)
(advice-add #'display-startup-echo-area-message :override #'ignore))
;; Display dividers between windows
(setq window-divider-default-places t
window-divider-default-bottom-width 1
window-divider-default-right-width 1)
(add-hook 'window-setup-hook #'window-divider-mode)
2026-04-05 21:31:02 +10:00
;; (pcase system-type
;; ('darwin ; macOS
(set-face-attribute 'default nil :font "Sarasa Term SC-22") ; 20 * 1.5
(set-face-attribute 'variable-pitch nil :font "Bookerly-20" :weight 'light)
(set-face-attribute 'fixed-pitch nil :font "Sarasa Term SC-22")
2026-03-11 21:08:31 +11:00
2026-04-05 21:31:02 +10:00
(add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 90))
2026-03-11 21:08:31 +11:00
2026-04-05 21:31:02 +10:00
;; ('gnu/linux ; Linux (including Debian)
;; (set-face-attribute 'variable-pitch nil :font "Sarasa Mono TC Nerd Font-14") ; 20 * 1.5
;; (add-to-list 'default-frame-alist '(height . 40))
;; (add-to-list 'default-frame-alist '(width . 90))))
2025-12-14 04:51:24 +11:00
2026-03-11 21:08:31 +11:00
(use-package mixed-pitch
2026-03-14 19:46:30 +11:00
:diminish
2026-03-11 21:08:31 +11:00
:hook org-mode
:hook LaTeX-mode)
2025-12-14 04:51:24 +11:00
2025-12-14 06:12:41 +11:00
(use-package diff-hl
2026-03-14 19:46:30 +11:00
:diminish
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init global-diff-hl-mode)
:hook (elpaca-after-init diff-hl-dired-mode)
:hook (elpaca-after-init diff-hl-flydiff-mode))
2025-12-14 04:51:24 +11:00
;; Easily adjust the font size in all frames
(use-package default-text-scale
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . default-text-scale-mode)
2025-12-14 04:51:24 +11:00
:bind (:map default-text-scale-mode-map
2026-03-20 00:44:25 +11:00
("C-s-=" . default-text-scale-increase)
("C-s--" . default-text-scale-decrease)
("C-s-0" . default-text-scale-reset)))
2025-12-14 04:51:24 +11:00
(setq hscroll-step 1
hscroll-margin 2
scroll-step 1
scroll-margin 0
scroll-conservatively 100000
scroll-preserve-screen-position t
auto-window-vscroll nil
;; mouse
mouse-wheel-scroll-amount-horizontal 1
mouse-wheel-progressive-speed nil)
2025-12-15 00:26:46 +11:00
(use-package nerd-icons
2026-04-02 19:21:30 +11:00
:ensure (nerd-icons
2026-04-03 15:54:22 +11:00
:type git
:host github
:repo "rainstormstudio/nerd-icons.el")
2026-03-29 19:12:45 +11:00
;; :files (:defaults "data"))
2025-12-15 00:26:46 +11:00
:custom
;; The Nerd Font you want to use in GUI
;; "Symbols Nerd Font Mono" is the default and is recommended
;; but you can use any other Nerd Font if you want
(nerd-icons-font-family "Symbols Nerd Font Mono"))
2026-03-22 23:57:48 +11:00
;; Display transient in child frame
;; (use-package transient-posframe
;; :diminish
;; :commands transient-posframe-mode
;; :custom-face
;; (transient-posframe-border ((t (:inherit posframe-border :background unspecified))))
2026-04-02 19:21:30 +11:00
;; :hook elpaca-after-init
2026-03-22 23:57:48 +11:00
;; :init (setq transient-mode-line-format nil
;; transient-posframe-parameters '((left-fringe . 8)
;; (right-fringe . 8))))
(with-no-warnings
(when (featurep 'ns)
;; Render thinner fonts
(setq ns-use-thin-smoothing t)
;; Don't open a file in a new frame
(setq ns-pop-up-frames nil)))
2026-04-03 15:54:22 +11:00
;; (use-package beacon
;; :diminish
;; :hook elpaca-after-init)
;; hl current line
(use-package hl-line
:ensure nil
2026-04-05 21:31:02 +10:00
:hook ((elpaca-after-init . global-hl-line-mode)
2026-04-03 22:48:09 +11:00
((dashboard-mode eshell-mode shell-mode term-mode vterm-mode eat-mode) .
2026-04-03 15:54:22 +11:00
(lambda () (setq-local global-hl-line-mode nil)))))
2026-04-03 22:48:09 +11:00
(use-package beacon
:hook elpaca-after-init)
2026-02-02 00:04:11 +11:00
2026-03-14 19:46:30 +11:00
(use-package spacious-padding
:diminish
2026-04-02 19:21:30 +11:00
:hook elpaca-after-init)
2026-03-29 19:12:45 +11:00
;; Eval result overlay
(use-package eros
2026-04-02 19:21:30 +11:00
:hook elpaca-after-init
2026-03-29 19:12:45 +11:00
:bind (([remap eval-defun] . eros-eval-defun)
([remap eval-last-sexp] . eros-eval-last-sexp)))
2026-02-22 05:24:39 +11:00
2026-04-03 15:54:22 +11:00
(use-package goggles
:diminish
:hook (prog-mode text-mode conf-mode))
2025-12-14 04:51:24 +11:00
(provide 'init-ui)