This commit is contained in:
Zelong Kuang
2026-03-11 21:08:31 +11:00
parent 4e569a2831
commit 2bfe738a6a
41 changed files with 385 additions and 54 deletions

View File

@@ -35,6 +35,7 @@
(setq display-line-numbers-type 'relative)
)
(column-number-mode 1)
(scroll-bar-mode -1)
(use-package subword
:ensure nil

View File

@@ -255,10 +255,10 @@
(advice-add #'persistent-scratch-save :before #'corfu-quit)
(add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer))
(use-package nerd-icons-corfu
:init
(with-eval-after-load 'corfu
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)))
;; (use-package nerd-icons-corfu
;; :init
;; (with-eval-after-load 'corfu
;; (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)))
(use-package wgrep
:commands wgrep-change-to-wgrep-mode

View File

@@ -8,18 +8,19 @@
:config
;; Always delete and copy recursively
(setq dired-recursive-deletes 'always
dired-recursive-copies 'always)
dired-recursive-copies 'always
dired-kill-when-opening-new-dired-buffer t)
;; Show directory first
(setq dired-listing-switches "-alh --group-directories-first"
dired-use-ls-dired t)
;; Colorful dired
(use-package diredfl
:diminish
:hook dired-mode
:hook dirvish-directory-view-mode)
;; Extra Dired functionality
(use-package dired-aux :ensure nil))

View File

@@ -88,6 +88,12 @@
:hook (elpaca-after-init . meow-global-mode)
:config
(meow-setup)
(setq meow-replace-state-name-list
'((normal . "<N>")
(motion . "<M>")
(keypad . "<K>")
(insert . "<I>")
(beacon . "<B>")))
(setq meow-cursor-type-normal 'bar))
(provide 'init-meow)

View File

@@ -7,12 +7,12 @@
(use-package org
:defer
:ensure `(org :repo "https://code.tecosaur.net/tec/org-mode.git/"
:ensure (org :repo "https://code.tecosaur.net/tec/org-mode.git/"
:branch "dev")
:hook (org-mode . org-cdlatex-mode)
:hook (org-mode . org-indent-mode)
:hook (org-mode . visual-line-mode)
:pretty-hydra
;; See `org-structure-template-alist'
((:color blue :quit-key ("q" "C-g"))
@@ -91,7 +91,7 @@ the element after the #+HEADER: tag."
(setq org-startup-indented t)
(setq org-pretty-entities t
org-pretty-entities-include-sub-superscripts nil)
(setq org-default-note-file (expand-file-name "notes.org" org-directory)
org-capture-templates
'(("t" "Personal todo" entry
@@ -103,10 +103,10 @@ the element after the #+HEADER: tag."
("j" "Journal" entry
(file+olp+datetree "diary.org")
"* %U %?\n%i\n%a" :prepend t))
org-todo-keywords
'((sequence "TODO(t)" "IN-PROGRESS(i)" "|" "DONE(d)" "NO(n)")))
(add-to-list 'org-src-block-faces '("latex" (:inherit default :extend t)))
(add-hook 'org-after-refile-insert-hook
(defun save-buffer-after-capture ()
@@ -194,6 +194,7 @@ the element after the #+HEADER: tag."
:config
(plist-put org-latex-preview-appearance-options
:page-width 0.8)
;; ;; Block C-n, C-p etc from opening up previews when using `org-latex-preview-mode'
;; (setq org-latex-preview-mode-ignored-commands
;; '(next-line previous-line mwheel-scroll

View File

@@ -2,7 +2,7 @@
(use-package latex
:ensure (auctex :pre-build (("./autogen.sh")
("./configure" "--without-texmf-dir" "--with-lispdir=.")
("./configure" "--without-texmf-dir" "--with-lispdir=.")
("make")))
:mode (("\\.tex\\'" . LaTeX-mode))
:hook (LaTeX-mode . prettify-symbols-mode)
@@ -11,11 +11,19 @@
:bind (:map LaTeX-mode-map
("C-S-e" . latex-math-from-calc))
:custom
(TeX-auto-save t)
(TeX-parse-self t)
(TeX-PDF-mode t)
(TeX-DVI-via-PDFTeX t)
(TeX-clean-confirm nil)
(TeX-save-query nil)
(TeX-source-correlate-mode t)
(TeX-source-correlate-method 'synctex)
(TeX-display-help t)
(TeX-show-compilation nil)
:config
(setq-default TeX-command-default "LaTeXMk")
(add-hook 'LaTeX-mode-hook (lambda ()
(setq TeX-command-default "LaTeXMk")))
;; Format math as a Latex string with Calc
(add-hook 'LaTeX-mode-hook #'eglot-ensure)
(defun latex-math-from-calc ()
@@ -30,29 +38,41 @@
calc-prefer-frac t
calc-angle-mode rad)))))
(t (let ((l (thing-at-point 'line)))
(end-of-line 1) (kill-line 0)
(end-of-line 1) (kill-line 0)
(insert (calc-eval `(,l
calc-language latex
calc-prefer-frac t
calc-angle-mode rad)))))))
(setq TeX-view-program-selection '((output-pdf "PDF Tools")))
;; (setq TeX-view-program-selection '((output-pdf "PDF Tools")))
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs '((LaTeX-mode latex-mode) "texlab")))
)
(add-to-list 'eglot-server-programs '((LaTeX-mode latex-mode) "texlab"))))
(use-package cdlatex
:diminish
:ensure t
:hook (LaTeX-mode . turn-on-cdlatex)
:bind (:map cdlatex-mode-map
("<tab>" . cdlatex-tab))
;; :bind (:map cdlatex-mode-map
;; ("<tab>" . cdlatex-tab))
:config
(setq cdlatex-math-symbol-alist '((?f ("\\varphi" "\\phi"))
(?i ("\\iota"))
))
(setq cdlatex-math-modify-alist '((?f "\\mathbb" nil t nil nil)))
(cdlatex-reset-mode))
(defun tjh/cdlatex-yas-expand ()
"Resolve the conflict between cdlatex and yasnippet. When this
function returns true, the default `cdlatex-tab` will not be
executed. The effect of function is to first try yasnippet
expansion, then cdlatex expansion."
(interactive)
(if (or (bound-and-true-p yas-minor-mode)
(bound-and-true-p yas-global-mode))
(if (yas-expand)
t
nil)
nil))
(add-hook 'cdlatex-tab-hook 'tjh/cdlatex-yas-expand))
(use-package texpresso
:defer nil

View File

@@ -19,15 +19,15 @@
(use-package solaire-mode
:hook (elpaca-after-init . solaire-global-mode))
;; (use-package standard-themes :demand t)
(use-package standard-themes :demand t)
(use-package ef-themes :demand t)
(use-package doric-themes
:demand t
:bind ("<f5>" . doric-load-random)
:init
(mapc #'disable-theme custom-enabled-themes)
(defun doric-load-random ()
(interactive)
(mapc #'disable-theme custom-enabled-themes)
(let* ((themes '(doric-fire
doric-oak
doric-jade
@@ -72,14 +72,13 @@
(use-package rainbow-mode
:hook elpaca-after-init)
;; (use-package doom-modeline
;; :hook (elpaca-after-ninit . doom-modeline-mode)
;; :config
;; (setq doom-modeline-support-imenu t
;; doom-modeline-height 30
;; doom-modeline-bar-width 8))
;; (use-package minions
;; :hook elpaca-after-init)
(use-package doom-modeline
:hook (elpaca-after-init . doom-modeline-mode)
:config
(setq doom-modeline-support-imenu t
doom-modeline-height 30
doom-modeline-buffer-file-name-style 'buffer-name
doom-modeline-enable-word-count t))
(use-package hide-mode-line
:autoload turn-off-hide-mode-line-mode
@@ -108,20 +107,21 @@
(pcase system-type
('darwin ; macOS
(set-face-attribute 'default nil :font "Sarasa Term SC-20") ; 20 * 1.5
(set-face-attribute 'variable-pitch nil :font "Bookerly-20" :weight 'light)
(set-face-attribute 'fixed-pitch nil :font "Sarasa Term SC-20")
(set-face-attribute 'default nil :font "Sarasa Term SC-22") ; 20 * 1.5
(set-face-attribute 'variable-pitch nil :font "Bookerly-22" :weight 'light)
(set-face-attribute 'fixed-pitch nil :font "Sarasa Term SC-22")
(add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 120)))
('gnu/linux ; Linux (including Debian)
(set-face-attribute 'variable-pitch nil :font "Sarasa Term SC-14") ; 20 * 1.5
(add-to-list 'default-frame-alist '(height . 40))
(add-to-list 'default-frame-alist '(width . 90))))
;; (use-package mixed-pitch
;; :hook org-mode)
(use-package mixed-pitch
:hook org-mode
:hook LaTeX-mode)
(use-package diff-hl
:init (global-diff-hl-mode))

View File

@@ -17,24 +17,24 @@
"*esh command on file*")))
(defun split-window-horizontally-instead ()
"Kill other windows and split the current window is on the top half of the frame."
"Kill other windows and split the current window horizontally."
(interactive)
(let* ((next-window (next-window))
(other-buffer (and next-window (window-buffer next-window))))
(delete-other-windows)
(split-window-horizontally)
(when other-buffer
(set-window-buffer next-window other-buffer))))
(set-window-buffer (next-window) other-buffer))))
(defun split-window-vertically-instead ()
"Kill other windows and split the current window is on left half of the frame."
"Kill other windows and split the current window vertically."
(interactive)
(let* ((next-window (next-window))
(other-buffer (and next-window (window-buffer next-window))))
(delete-other-windows)
(split-window-vertically)
(when other-buffer
(set-window-buffer next-window other-buffer))))
(set-window-buffer (next-window) other-buffer))))
(use-package ace-window
:hook (emacs-startup . ace-window-display-mode)
@@ -133,7 +133,7 @@
"\\*vc-.*\\**"
"\\*diff-hl\\**"
"^\\*macro expansion\\**"
"\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*"
"\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
"\\*docker-.+\\*"
@@ -146,7 +146,7 @@
(display-buffer-reuse-window display-buffer-in-direction)
(direction . right)
(window-width . 0.5)))
:config
(with-no-warnings
(defun my-popper-fit-window-height (win)

View File

@@ -3,6 +3,8 @@
(use-package project)
(global-set-key (kbd "C-x C-b") #'ibuffer)
;; (use-package tab-bar
;; :ensure nil
;; :init
@@ -14,8 +16,6 @@
;; (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
@@ -39,7 +39,7 @@
;; (tabspaces-session-auto-restore t)
;; (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)
@@ -58,7 +58,7 @@
;; "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)