2025-12-14 04:51:24 +11:00
|
|
|
;; -*- lexical-binding: t -*-
|
2025-12-14 21:09:42 +11:00
|
|
|
|
2025-12-15 18:20:19 +11:00
|
|
|
(use-package benchmark-init
|
|
|
|
|
:ensure t
|
|
|
|
|
:demand t
|
|
|
|
|
:config
|
|
|
|
|
;; To disable collection of benchmark data after init is done.
|
|
|
|
|
(add-hook 'elpaca-after-init-hook 'benchmark-init/deactivate))
|
|
|
|
|
|
2025-12-17 07:08:46 +11:00
|
|
|
(setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
|
|
|
|
|
(add-hook 'elpaca-after-init-hook (lambda () (load custom-file 'no-error 'no-message)))
|
|
|
|
|
|
2025-12-20 15:13:13 +11:00
|
|
|
(use-package server
|
|
|
|
|
:ensure nil
|
|
|
|
|
:hook (elpaca-after-init . server-mode))
|
|
|
|
|
|
|
|
|
|
(use-package display-line-numbers
|
|
|
|
|
:ensure nil
|
|
|
|
|
:hook (elpaca-after-init . global-display-line-numbers-mode)
|
|
|
|
|
:config
|
|
|
|
|
(dolist (mode '(erc-mode-hook
|
|
|
|
|
circe-mode-hook
|
|
|
|
|
help-mode-hook
|
|
|
|
|
gud-mode-hook
|
|
|
|
|
treemacs-mode-hook
|
|
|
|
|
vterm-mode-hook))
|
|
|
|
|
(add-hook mode (lambda () (display-line-numbers-mode -1))))
|
|
|
|
|
(setq display-line-numbers-type 'relative)
|
|
|
|
|
)
|
2025-12-19 09:44:24 +11:00
|
|
|
(column-number-mode 1)
|
2025-12-17 07:08:46 +11:00
|
|
|
|
2025-12-20 15:13:13 +11:00
|
|
|
(use-package subword
|
|
|
|
|
:ensure nil
|
2025-12-22 12:30:25 +11:00
|
|
|
:diminish
|
|
|
|
|
:hook (prog-mode minibuffer-setup))
|
2025-12-20 15:13:13 +11:00
|
|
|
|
|
|
|
|
(use-package paren
|
|
|
|
|
:ensure nil
|
|
|
|
|
:hook (elpaca-after-init . show-paren-mode))
|
2025-12-17 07:08:46 +11:00
|
|
|
|
2025-12-14 04:51:24 +11:00
|
|
|
(recentf-mode 1)
|
2025-12-20 15:13:13 +11:00
|
|
|
(use-package recentf
|
|
|
|
|
:ensure nil
|
|
|
|
|
:hook (elpaca-after-init . recentf-mode)
|
|
|
|
|
:custom
|
|
|
|
|
(recentf-max-saved-items 500))
|
2025-12-17 07:08:46 +11:00
|
|
|
|
|
|
|
|
(setq-default cursor-type 'bar)
|
2025-12-14 04:51:24 +11:00
|
|
|
(setq make-backup-files nil)
|
2025-12-14 06:09:17 +11:00
|
|
|
(setq use-short-answers t)
|
2025-12-15 05:50:04 +11:00
|
|
|
(setq frame-title-format "Emacs: %b")
|
2025-12-17 07:08:46 +11:00
|
|
|
(setq custom-safe-themes t)
|
2025-12-16 08:23:57 +11:00
|
|
|
|
2025-12-22 12:44:51 +11:00
|
|
|
(pcase system-type ('darwin (setq insert-directory-program "gls")))
|
|
|
|
|
|
2025-12-21 10:30:07 +11:00
|
|
|
(setq-default tab-width 4
|
|
|
|
|
compilation-scroll-output t
|
|
|
|
|
indent-tabs-mode nil)
|
|
|
|
|
|
2025-12-17 07:08:46 +11:00
|
|
|
(setq ring-bell-function 'ignore)
|
2025-12-16 08:23:57 +11:00
|
|
|
(setq undo-limit 80000000
|
|
|
|
|
auto-save-default t
|
|
|
|
|
password-cache-expiry nil)
|
|
|
|
|
|
2025-12-17 07:08:46 +11:00
|
|
|
(setq-default delete-by-moving-to-trash t
|
|
|
|
|
x-stretch-cursor t
|
|
|
|
|
window-combination-resize t)
|
2025-12-15 22:42:06 +11:00
|
|
|
|
2025-12-15 05:50:04 +11:00
|
|
|
(define-key global-map (kbd "C-<wheel-up>") nil)
|
|
|
|
|
(define-key global-map (kbd "C-<wheel-down>") nil)
|
|
|
|
|
(global-set-key (kbd "s-a") 'mark-whole-buffer) ;;对应Windows上面的Ctrl-a 全选
|
|
|
|
|
(global-set-key (kbd "s-c") 'kill-ring-save) ;;对应Windows上面的Ctrl-c 复制
|
|
|
|
|
(global-set-key (kbd "s-s") 'save-buffer) ;; 对应Windows上面的Ctrl-s 保存
|
|
|
|
|
(global-set-key (kbd "s-v") 'yank) ;对应Windows上面的Ctrl-v 粘贴
|
|
|
|
|
(global-set-key (kbd "s-z") 'undo) ;对应Windows上面的Ctrol-z 撤销
|
2025-12-14 22:30:26 +11:00
|
|
|
|
|
|
|
|
(setq kill-ring-max 200)
|
|
|
|
|
;; Save clipboard contents into kill-ring before replace them
|
|
|
|
|
(setq save-interprogram-paste-before-kill t)
|
2025-12-15 05:50:04 +11:00
|
|
|
|
2025-12-14 22:30:26 +11:00
|
|
|
;; Kill & Mark things easily
|
|
|
|
|
(use-package easy-kill
|
|
|
|
|
:bind (([remap kill-ring-save] . easy-kill)
|
|
|
|
|
([remap mark-sexp] . easy-mark)))
|
|
|
|
|
|
2025-12-14 09:04:11 +11:00
|
|
|
(use-package ultra-scroll
|
|
|
|
|
:init
|
|
|
|
|
(setq scroll-conservatively 3
|
|
|
|
|
scroll-margin 0)
|
2025-12-15 18:20:19 +11:00
|
|
|
:hook (elpaca-after-init . ultra-scroll-mode))
|
2025-12-22 12:30:25 +11:00
|
|
|
|
|
|
|
|
(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" . helpful-at-point)
|
|
|
|
|
:map lisp-interaction-mode-map
|
|
|
|
|
("C-c C-d" . helpful-at-point)
|
|
|
|
|
:map helpful-mode-map
|
|
|
|
|
("r" . remove-hook-at-point))
|
|
|
|
|
:hook (helpful-mode . cursor-sensor-mode) ; for remove-advice button
|
|
|
|
|
:init
|
|
|
|
|
(with-no-warnings
|
|
|
|
|
(with-eval-after-load 'apropos
|
|
|
|
|
;; patch apropos buttons to call helpful instead of help
|
|
|
|
|
(dolist (fun-bt '(apropos-function apropos-macro apropos-command))
|
|
|
|
|
(button-type-put
|
|
|
|
|
fun-bt 'action
|
|
|
|
|
(lambda (button)
|
|
|
|
|
(helpful-callable (button-get button 'apropos-symbol)))))
|
|
|
|
|
(dolist (var-bt '(apropos-variable apropos-user-option))
|
|
|
|
|
(button-type-put
|
|
|
|
|
var-bt 'action
|
|
|
|
|
(lambda (button)
|
|
|
|
|
(helpful-variable (button-get button 'apropos-symbol))))))))
|
|
|
|
|
|
2025-12-14 04:51:24 +11:00
|
|
|
(provide 'init-better-default)
|