- Replace projectile with built-in project.el - Add cal-china-x for Chinese lunar calendar support - Add dired-gitignore integration with dirvish - Add mwim for smarter line navigation - Add keycast mode for key display - Add ef-themes theme collection - Improve corfu terminal handling for Emacs 31+ - Add gptel-agent-project and consult-ripgrep-project helpers - Remove custom.el from repo, support init-local.el for local config - Update theme faces for transient, keycast, and calendar holidays - Various keybinding additions and cleanup
156 lines
4.3 KiB
EmacsLisp
156 lines
4.3 KiB
EmacsLisp
;;; init-ui.el --- ui and other style customization cofig -*- lexical-binding: t -*-
|
||
|
||
;;; Commentary:
|
||
|
||
;;; Code:
|
||
|
||
;; 设置系统编码
|
||
(when (fboundp 'set-charset-priority)
|
||
(set-charset-priority 'unicode))
|
||
|
||
(if *is-windows*
|
||
(progn
|
||
(set-language-environment 'chinese-gbk)
|
||
(prefer-coding-system 'utf-8-auto))
|
||
(progn
|
||
(set-language-environment "UTF-8")
|
||
(prefer-coding-system 'utf-8)))
|
||
|
||
;; 预览所有可用emacs颜色
|
||
(defun my-color-picker ()
|
||
"Pick a color with preview."
|
||
(interactive)
|
||
(let* ((colors (defined-colors))
|
||
(choice (completing-read
|
||
"Color: "
|
||
(mapcar (lambda (c)
|
||
(propertize
|
||
(format "%-20s %s" c "████")
|
||
'face `(:foreground ,c)))
|
||
colors))))
|
||
(string-trim (car (split-string choice)))))
|
||
|
||
;; org-mode美化
|
||
(use-package olivetti
|
||
:delight
|
||
:init
|
||
(add-hook 'olivetti-mode-hook
|
||
(lambda ()
|
||
(display-line-numbers-mode -1)))
|
||
(add-hook 'org-mode-hook
|
||
(lambda ()
|
||
(olivetti-mode 1))))
|
||
|
||
;; rainbow mode
|
||
(use-package rainbow-mode)
|
||
|
||
;; rainbow-delimiters
|
||
(use-package rainbow-delimiters)
|
||
|
||
;; 自定义主题路径
|
||
(add-to-list 'custom-theme-load-path "~/.emacs.d/lisp/")
|
||
|
||
;; 信任所有主题
|
||
(setq custom-safe-themes t)
|
||
|
||
;; 安装solarized dark
|
||
(use-package solarized-theme
|
||
:straight
|
||
'(solarized-emacs :fork (:host github :repo "Andsy10/solarized-emacs")))
|
||
|
||
;; 把主题加载延迟到frame创建之后,防止daemon模式下宏不能正常展开
|
||
(if *is-android*
|
||
(if (daemonp)
|
||
(add-hook 'after-make-frame-functions
|
||
(lambda (frame)
|
||
(with-selected-frame frame
|
||
(load-theme 'my-base16-light t))))
|
||
(load-theme 'my-base16-light t))
|
||
(if (daemonp)
|
||
(add-hook 'after-make-frame-functions
|
||
(lambda (frame)
|
||
(with-selected-frame frame
|
||
(load-theme 'my-base16-dark t))))
|
||
(load-theme 'my-base16-dark t)))
|
||
|
||
;; 很多主题
|
||
;; (use-package doom-themes)
|
||
;; (use-package color-theme-modern)
|
||
(use-package naysayer-theme)
|
||
(use-package ef-themes)
|
||
|
||
(if *is-android*
|
||
(use-package simple-modeline
|
||
:init
|
||
(simple-modeline-mode)))
|
||
|
||
;; eshell高亮
|
||
(use-package eshell-syntax-highlighting
|
||
:hook
|
||
(eshell-mode . eshell-syntax-highlighting-global-mode))
|
||
|
||
(add-hook 'eshell-mode-hook
|
||
(lambda ()
|
||
(setenv "TERM" "xterm-256color")
|
||
(setenv "COLORTERM" "truecolor")
|
||
(add-to-list 'eshell-output-filter-functions 'eshell-handle-ansi-color t)
|
||
(setq-local eshell-prefer-lisp-functions nil)
|
||
(setenv "LS_COLORS"
|
||
"di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46")))
|
||
|
||
;; 缩进线
|
||
(use-package indent-bars
|
||
:custom
|
||
(indent-bars-color '(font-lock-comment-face :face-bg nil :blend 0.4))
|
||
(indent-bars-highlight-current-depth '(:face default :blend 0.4))
|
||
(indent-bars-pattern ".")
|
||
(indent-bars-width-frac 0.1)
|
||
(indent-bars-pad-frac 0.1)
|
||
(indent-bars-color-by-depth nil)
|
||
(indent-bars-no-descend-string t)
|
||
(indent-bars-prefer-character t))
|
||
|
||
;; 高亮当前行
|
||
(global-hl-line-mode t)
|
||
|
||
;; 显示文件大小
|
||
(size-indication-mode t)
|
||
|
||
;; 显示行号列号
|
||
(column-number-mode t)
|
||
|
||
;; 显示时间
|
||
(setq display-time-default-load-average nil
|
||
display-time-string-forms
|
||
'((propertize
|
||
(concat
|
||
(propertize (format-time-string " %H:%M") 'face 'display-time-date-and-time)
|
||
(propertize (format-time-string "-%p") 'face 'font-lock-comment-face))
|
||
'help-echo (format-time-string "%A, %B %d, %Y"))))
|
||
(display-time-mode)
|
||
|
||
;; 添加个人字体到 cnfonts
|
||
(setq cnfonts-personal-fontnames
|
||
'(("Sarasa Fixed TC") ; 英文字体
|
||
("Sarasa Fixed TC") ; 中文字体
|
||
nil ; Ext-B 字体(可选)
|
||
nil ; Symbol 字体(可选)
|
||
nil)) ; 装饰字体(可选)
|
||
|
||
;; 安装cnfonts脚本,用于修复中英文对齐
|
||
(use-package cnfonts
|
||
:init
|
||
(add-hook 'after-init-hook 'cnfonts-mode)
|
||
:config
|
||
(cnfonts--select-profile "profile1"))
|
||
|
||
;; 主题修复脚本
|
||
(defun fix-theme-colors ()
|
||
"Fix invalid color name in theme files."
|
||
(interactive)
|
||
(load-file (expand-file-name "~/.emacs.d/lisp/fix-theme-colors.el")))
|
||
|
||
(provide 'init-ui)
|
||
|
||
;;; init-ui.el ends here
|