This commit is contained in:
Zelong Kuang
2026-02-25 22:12:47 +11:00
parent c32094700d
commit b7832a60d1
10 changed files with 121 additions and 98 deletions

View File

@@ -36,6 +36,6 @@
;; (push '(ns-appearance . dark) default-frame-alist))
;; Prevent flash of unstyled mode line
(setq mode-line-format nil)
;; (setq mode-line-format nil)
(provide 'early-init)

View File

@@ -65,7 +65,8 @@
(pcase system-type ('darwin (setq insert-directory-program "gls")))
(setq-default tab-width 4
(setq-default tab-width 2
standard-indent 2
compilation-scroll-output t
indent-tabs-mode nil)
@@ -128,7 +129,10 @@
(lambda (button)
(helpful-variable (button-get button 'apropos-symbol))))))))
(setq auto-save-default nil)
;; (setq auto-save-file-name-transforms
;; `((".*" ,(concat user-emacs-directory "auto-save/") t)))
(provide 'init-better-default)

View File

@@ -4,12 +4,14 @@
:ensure nil
:init (setq-default c-basic-offset 2))
(when (treesit-available-p)
(use-package c-ts-mode
:ensure nil
:functions treesit-available-p
:init
(setq c-ts-mode-indent-offset 2)
(setq-default c-basic-offset 2)
(when (boundp 'major-mode-remap-alist)
(add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))

View File

@@ -1,37 +1,40 @@
;; -*- lexical-binding: t -*-
;; (use-package smartparens
;; :hook (elpaca-after-init . smartparens-global-mode)
;; ;; :hook (elpaca-after-init . smartparens-global-strict-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)))
(use-package smartparens
:diminish
:hook (elpaca-after-init . smartparens-global-mode)
;; :hook (elpaca-after-init . smartparens-global-strict-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))
(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")))
;; )
;; 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 electric-pair
:ensure nil
:hook elpaca-after-init)
;; resolve conflict with hungry-delete
(defadvice hungry-delete-backward (before sp-delete-pair-advice activate) (save-match-data (sp-delete-pair (ad-get-arg 0)))))
;; (use-package electric-pair
;; :ensure nil
;; :hook elpaca-after-init)
;; Hungry deletion
(use-package hungry-delete
@@ -43,6 +46,7 @@
;; Yasnippet settings
(use-package yasnippet
:diminish
:ensure t
:hook (elpaca-after-init . yas-global-mode)
:hook ((LaTeX-mode . yas-minor-mode)
@@ -65,13 +69,17 @@
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
(yas-expand)))))
(use-package abbrev
:diminish
:ensure nil
:config
(setq-default abbrev-mode t)
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory))
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory)))
(use-package autorevert
:ensure nil
:diminish
:hook (after-init . global-auto-revert-mode))
:hook (elpaca-after-init . global-auto-revert-mode))
(use-package multiple-cursors
:hook elpaca-after-init

View File

@@ -37,7 +37,12 @@
;; (use-package eldoc-box
;; :hook (eglot-managed-mode . eldoc-box-hover-at-point-mode))
(use-package eldoc
:ensure nil
:diminish)
(use-package eldoc-mouse
:diminish
:hook eldoc-mode)
(provide 'init-eglot)

View File

@@ -56,11 +56,13 @@
;;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)
(use-package diminish)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@@ -2,6 +2,7 @@
(use-package gcmh
:diminish
:init
(gcmh-mode 1)
:config

View File

@@ -77,8 +77,8 @@
;; (setq doom-modeline-support-imenu t
;; doom-modeline-height 30
;; doom-modeline-bar-width 8))
(use-package minions
:hook elpaca-after-init)
;; (use-package minions
;; :hook elpaca-after-init)
(use-package hide-mode-line
:autoload turn-off-hide-mode-line-mode
@@ -161,6 +161,7 @@
:hook (ibuffer-mode-hook . nerd-icons-ibuffer-mode))
(use-package beacon
:diminish
:hook elpaca-after-init)
(use-package spacious-padding)

View File

@@ -36,9 +36,9 @@
:config
(pdf-tools-install))
(use-package keycast
:hook (elpaca-after-init . keycast-tab-bar-mode)
:config
(setq keycast-mode-line-remove-tail-elements nil))
;; (use-package keycast
;; :hook (elpaca-after-init . keycast-mode-line-mode)
;; :config
;; (setq keycast-mode-line-remove-tail-elements nil))
(provide 'init-utils)

View File

@@ -3,66 +3,66 @@
(use-package project)
(use-package tab-bar
:ensure nil
:init
(tab-bar-mode t)
(setq tab-bar-new-tab-choice "*scratch*") ;; buffer to show in new tabs
(setq tab-bar-close-button-show nil) ;; hide tab close / X button
(setq tab-bar-show 1) ;; hide bar if <= 1 tabs open
(setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator))
;; (use-package tab-bar
;; :ensure nil
;; :init
;; (tab-bar-mode t)
;; (setq tab-bar-new-tab-choice "*scratch*") ;; buffer to show in new tabs
;; (setq tab-bar-close-button-show nil) ;; hide tab close / X button
;; (setq tab-bar-show t) ;; hide bar if <= 1 tabs open
;; (setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator))
(setq tab-bar-tab-hints t))
;; (setq tab-bar-tab-hints t))
(global-set-key (kbd "C-x C-b") #'ibuffer)
(use-package tabspaces
:functions tabspaces-mode
:commands (tabspaces-switch-or-create-workspace
tabspaces-open-or-create-project-and-workspace)
:hook (elpaca-after-init . tabspaces-mode)
:bind (:map tabspaces-mode-map
([remap project-switch-project] . tabspaces-project-switch-project-open-file))
:bind (:map tabspaces-command-map
("l" . tabspaces-restore-session)
("s" . tabspaces-save-session)
("TAB" . tabspaces-switch-or-create-workspace))
;; (use-package tabspaces
;; :functions tabspaces-mode
;; :commands (tabspaces-switch-or-create-workspace
;; tabspaces-open-or-create-project-and-workspace)
;; :hook (elpaca-after-init . tabspaces-mode)
;; :bind (:map tabspaces-mode-map
;; ([remap project-switch-project] . tabspaces-project-switch-project-open-file))
;; :bind (:map tabspaces-command-map
;; ("l" . tabspaces-restore-session)
;; ("s" . tabspaces-save-session)
;; ("TAB" . tabspaces-switch-or-create-workspace))
:custom
(tabspaces-use-filtered-buffers-as-default t)
(tabspaces-default-tab "Default")
(tabspaces-remove-to-default t)
(tabspaces-include-buffers '("*scratch*" "*Messages*"))
(tabspaces-exclude-buffers '("*eat*" "*vterm*" "*shell*" "*eshell*"))
;; sessions
(tabspaces-session t)
;; :custom
;; (tabspaces-use-filtered-buffers-as-default t)
;; (tabspaces-default-tab "Default")
;; (tabspaces-remove-to-default t)
;; (tabspaces-include-buffers '("*scratch*" "*Messages*"))
;; (tabspaces-exclude-buffers '("*eat*" "*vterm*" "*shell*" "*eshell*"))
;; ;; sessions
;; (tabspaces-session t)
;; (tabspaces-session-auto-restore t)
(tabspaces-keymap-prefix "C-c o")
(tab-bar-new-tab-choice "default")
;; (tabspaces-keymap-prefix "C-c o")
;; (tab-bar-new-tab-choice "default")
(with-eval-after-load 'consult
;; hide full buffer list (still available with "b" prefix)
(consult-customize consult--source-buffer :hidden nil :default nil)
;; set consult-workspace buffer list
(defvar consult--source-workspace
(list :name "Workspace Buffers"
:narrow ?w
:history 'buffer-name-history
:category 'buffer
:state #'consult--buffer-state
:default t
:items (lambda () (consult--buffer-query
:predicate #'tabspaces--local-buffer-p
:sort 'visibility
:as #'buffer-name)))
;; (with-eval-after-load 'consult
;; ;; hide full buffer list (still available with "b" prefix)
;; (consult-customize consult--source-buffer :hidden nil :default nil)
;; ;; set consult-workspace buffer list
;; (defvar consult--source-workspace
;; (list :name "Workspace Buffers"
;; :narrow ?w
;; :history 'buffer-name-history
;; :category 'buffer
;; :state #'consult--buffer-state
;; :default t
;; :items (lambda () (consult--buffer-query
;; :predicate #'tabspaces--local-buffer-p
;; :sort 'visibility
;; :as #'buffer-name)))
"Set workspace buffer list for consult-buffer.")
(add-to-list 'consult-buffer-sources 'consult--source-workspace)))
;; "Set workspace buffer list for consult-buffer.")
;; (add-to-list 'consult-buffer-sources 'consult--source-workspace)))
;; (use-package beframe
;; :hook elpaca-after-init
;; :bind (("C-x b" . beframe-switch-buffer)
;; ("C-x C-b" . beframe-buffer-menu))
(use-package beframe
:hook elpaca-after-init
:bind (("C-x b" . beframe-switch-buffer)
("C-x C-b" . beframe-buffer-menu)))
;; :config
;; (setq beframe-functions-in-frames '(project-prompt-project-dir)))