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)) ;; (push '(ns-appearance . dark) default-frame-alist))
;; Prevent flash of unstyled mode line ;; Prevent flash of unstyled mode line
(setq mode-line-format nil) ;; (setq mode-line-format nil)
(provide 'early-init) (provide 'early-init)

View File

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

View File

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

View File

@@ -1,37 +1,40 @@
;; -*- lexical-binding: t -*- ;; -*- lexical-binding: t -*-
;; (use-package smartparens (use-package smartparens
;; :hook (elpaca-after-init . smartparens-global-mode) :diminish
;; ;; :hook (elpaca-after-init . smartparens-global-strict-mode) :hook (elpaca-after-init . smartparens-global-mode)
;; :init (sp-use-paredit-bindings) ;; :hook (elpaca-after-init . smartparens-global-strict-mode)
;; :config :init (sp-use-paredit-bindings)
;; ;; Autopair quotes more conservatively; if I'm next to a word/before another :config
;; ;; quote, I don't want to open a new pair or it would unbalance them. ;; Autopair quotes more conservatively; if I'm next to a word/before another
;; (let ((unless-list '(sp-point-before-word-p ;; quote, I don't want to open a new pair or it would unbalance them.
;; sp-point-after-word-p (let ((unless-list '(sp-point-before-word-p
;; sp-point-before-same-p))) sp-point-after-word-p
;; (sp-pair "'" nil :unless unless-list) sp-point-before-same-p)))
;; (sp-pair "\"" nil :unless unless-list)) (sp-pair "'" nil :unless unless-list)
;; (dolist (brace '("(" "{" "[")) (sp-pair "\"" nil :unless unless-list))
;; (sp-pair brace nil (dolist (brace '("(" "{" "["))
;; :post-handlers '(("||\n[i]" "RET") ("| " "SPC")) (sp-pair brace nil
;; ;; Don't autopair opening braces if before a word character or :post-handlers '(("||\n[i]" "RET") ("| " "SPC"))
;; ;; other opening brace. The rationale: it interferes with manual ;; Don't autopair opening braces if before a word character or
;; ;; balancing of braces, and is odd form to have s-exps with no ;; other opening brace. The rationale: it interferes with manual
;; ;; whitespace in between, e.g. ()()(). Insert whitespace if ;; balancing of braces, and is odd form to have s-exps with no
;; ;; genuinely want to start a new form in the middle of a word. ;; whitespace in between, e.g. ()()(). Insert whitespace if
;; :unless '(sp-point-before-word-p sp-point-before-same-p))) ;; 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 ;; 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) (sp-local-pair '(emacs-lisp-mode org-mode markdown-mode markdown-ts-mode gfm-mode)
;; "[" nil :post-handlers '(:rem ("| " "SPC"))) "[" nil :post-handlers '(:rem ("| " "SPC")))
;; )
(use-package electric-pair ;; resolve conflict with hungry-delete
:ensure nil (defadvice hungry-delete-backward (before sp-delete-pair-advice activate) (save-match-data (sp-delete-pair (ad-get-arg 0)))))
:hook elpaca-after-init)
;; (use-package electric-pair
;; :ensure nil
;; :hook elpaca-after-init)
;; Hungry deletion ;; Hungry deletion
(use-package hungry-delete (use-package hungry-delete
@@ -43,6 +46,7 @@
;; Yasnippet settings ;; Yasnippet settings
(use-package yasnippet (use-package yasnippet
:diminish
:ensure t :ensure t
:hook (elpaca-after-init . yas-global-mode) :hook (elpaca-after-init . yas-global-mode)
:hook ((LaTeX-mode . yas-minor-mode) :hook ((LaTeX-mode . yas-minor-mode)
@@ -65,13 +69,17 @@
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto))) (let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
(yas-expand))))) (yas-expand)))))
(setq-default abbrev-mode t) (use-package abbrev
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory)) :diminish
:ensure nil
:config
(setq-default abbrev-mode t)
(setq abbrev-file-name (expand-file-name "abbrev.el" user-emacs-directory)))
(use-package autorevert (use-package autorevert
:ensure nil :ensure nil
:diminish :diminish
:hook (after-init . global-auto-revert-mode)) :hook (elpaca-after-init . global-auto-revert-mode))
(use-package multiple-cursors (use-package multiple-cursors
:hook elpaca-after-init :hook elpaca-after-init

View File

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

View File

@@ -56,11 +56,13 @@
;;For example: ;;For example:
;;(use-package general :ensure (:wait t) :demand t) ;;(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 (setq use-package-always-ensure t
use-package-expand-minimally t use-package-expand-minimally t
use-package-always-defer t) use-package-always-defer t)
(use-package diminish)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

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

View File

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

View File

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

View File

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