diff --git a/lisp/init-elpa.el b/lisp/init-elpa.el index cbeaaff..13be21c 100644 --- a/lisp/init-elpa.el +++ b/lisp/init-elpa.el @@ -28,8 +28,8 @@ ;; 从develop分支而不是main分支获取straight.el (setq straight-repository-branch t) -;; 安装use-package -(straight-use-package 'use-package) +;; 安装use-package,emacs29以上别装 +;; (straight-use-package 'use-package) ;; 配置 use-package (setq use-package-always-defer t @@ -38,8 +38,15 @@ straight-use-package-version t straight-use-package-by-default t) +;; delight +(use-package delight + :config + (delight '((eldoc-mode nil eldoc) + (org-indent-mode nil org)))) + ;; 安装gcmh用于管理内存回收 (use-package gcmh + :delight :demand t :init (setq gcmh-idle-delay 'auto diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el index 66b3113..3c28fff 100644 --- a/lisp/init-kbd.el +++ b/lisp/init-kbd.el @@ -151,7 +151,6 @@ "C-" 'org-cycle-parent-subtree "C-c i" 'consult-outline "C-c t l" 'org-toggle-link-display - "C-c C-k" 'kmacro-call-macroe "M-{" 'org-previous-visible-heading "M-}" 'org-next-visible-heading) @@ -173,7 +172,7 @@ "c" 'hydra-multiple-cursors/body "r" 'restart-emacs "e" 'er/expand-region - "s" 'consult-focus-lines + "s" 'consult-line "i" 'consult-imenu "I" 'consult-imenu-multi "a" 'org-agenda @@ -181,8 +180,8 @@ "k" 'comment-line ;; "v" 'vterm "E" 'eshell - "C-k" 'kmacro-call-macro - "C-t" 'trashed) + "C-t" 'trashed + "C-s" 'consult-focus-lines) ;; global map (general-def @@ -221,10 +220,10 @@ "M-p" 'backward-paragraph "M-n" 'forward-paragraph "" 'xref-find-definitions-at-mouse - "C-s" 'consult-line "C-M-;" 'avy-goto-char "C-M-'" 'avy-goto-word-1 "M-g g" 'avy-goto-line + "M-g M-g" 'consult-goto-line ;; window "M-" 'shrink-window-horizontally @@ -238,8 +237,7 @@ ;; other "C-x r b" 'consult-bookmark - "C-;" 'embark-act - "" 'global-tab-line-mode) + "C-;" 'embark-act) ;; expand region (setq expand-region-reset-fast-key "r") diff --git a/lisp/init-org.el b/lisp/init-org.el index d02c474..1ace50b 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -8,11 +8,11 @@ ;; 一些随org-mode加载的基础配置 (add-hook 'org-mode-hook - (lambda () - (require 'org-tempo) - (org-indent-mode) + (lambda () + (require 'org-tempo) + (org-indent-mode) (visual-line-mode) - (setq-local electric-pair-inhibit-predicate + (setq-local electric-pair-inhibit-predicate (lambda (char) (or (eq char ?<) (electric-pair-default-inhibit char)))))) @@ -20,12 +20,12 @@ ;; 预加载,防止windows的org-mode加载卡顿 (if *is-windows* (progn (run-with-idle-timer - 0.5 nil - (lambda () - (with-temp-buffer - (org-mode) - (org-mode)) - (message "Org preloaded"))))) + 0.5 nil + (lambda () + (with-temp-buffer + (org-mode) + (org-mode)) + (message "Org preloaded"))))) ;; 设置标题字体大小 ;; (with-eval-after-load 'org @@ -51,14 +51,11 @@ (cond (*is-windows* (setq org-agenda-files '("h:/emacs/hugo/this-is-my-blog/all-blog.org" - "h:/emacs/my-org-daily/" - "h:/emacs/my-org-note/"))) + "h:/emacs/my-org-daily/"))) (*is-mac* - (setq org-agenda-files '("~/org/my-org-daily" - "~/org/my-org-note/"))) + (setq org-agenda-files '("~/org/my-org-daily"))) (*is-linux* - (setq org-agenda-files '("~/org/my-org-daily/" - "~/org/my-org-note/")))) + (setq org-agenda-files '("~/org/my-org-daily/")))) (setq org-agenda-span 'day) (setq org-default-priority ?C) @@ -91,11 +88,16 @@ ;; consult-notes (use-package consult-notes + :straight + '(consult-notes :fork (:host github :repo "Andsy10/consult-notes")) :init (consult-notes-denote-mode) :config (setq consult-notes-file-dir-sources '(("Org Notes" ?n "~/org/my-org-note/" :hidden t) - ("Org Journal" ?j "~/org/my-org-daily/" :hidden t)))) + ("Org Journal" ?j "~/org/my-org-daily/" :hidden t))) + (setq consult-notes-denote-display-keywords-indicator "_") + (setq consult-notes-denote-display-id-format 'date) + (setq consult-notes-denote-display-signature t)) ;; org-download (use-package org-download @@ -118,7 +120,7 @@ (use-package org-journal :config (setq org-journal-file-format "%Y-%m-%d.org" - org-journal-file-header "#+category: journal\n#+STARTUP: content\n\n" + org-journal-file-header "#+category: journal\n#+STARTUP: content\n\n" org-journal-time-prefix "\n*** TODO " org-journal-time-format "%m-%d \n<%Y-%m-%d %a %H:%M:%S>\n" org-journal-hide-entries-p t @@ -127,7 +129,7 @@ (format-time-string "%Y-%m-%d" time) (format-time-string "%a" time) (format-time-string "%Y-%m-%d %a" time))) - org-journal-carryover-items "TODO=\"TODO\"|TODO=\"STARTED\"|TODO=\"WAITING\"|TODO=\"SOMEDAY\"") + org-journal-carryover-items "TODO=\"TODO\"|TODO=\"STARTED\"|TODO=\"WAITING\"|TODO=\"SOMEDAY\"") (if *is-windows* (setq org-journal-dir "h:/emacs/my-org-daily/") @@ -166,7 +168,7 @@ (funcall org-journal-find-file org-journal-file) (unless (org-journal--daily-p) (org-journal--goto-entry date))) - (message "No journal entry for this date.")))) + (message "No journal entry for this date.")))) (defun my/org-journal-mark-old-todos-as-comment (entries) "Change TODO entry's TODO keyword to COMMENT after carryover." @@ -176,23 +178,23 @@ org-todo-keywords-1)) (todo-pattern (when todo-keywords (regexp-opt todo-keywords 'words)))) - (when todo-pattern + (when todo-pattern (mapc (lambda (entry) (let ((start (car entry)) - (end (set-marker (make-marker) (cadr entry)))) + (end (set-marker (make-marker) (cadr entry)))) (goto-char start) (while (re-search-forward (concat "^\\(\\*+ \\)" todo-pattern) end t) (replace-match "\\1COMMENT" t nil)) (set-marker end nil))) - (reverse entries)))) + (reverse entries)))) (save-buffer))) (setq org-journal-handle-old-carryover-fn #'my/org-journal-mark-old-todos-as-comment) ;; 在org-journal加载cns-mode (add-hook 'org-journal-mode-hook - (lambda () - (global-cns-mode-enable-in-buffer)))) + (lambda () + (global-cns-mode-enable-in-buffer)))) ;; org-ql (use-package org-ql @@ -226,29 +228,29 @@ (setq org-agenda-custom-commands '(("pa" "Priority >= A" ((tags-todo "+PRIORITY=\"A\""))) - ("pb" "Priority >= B" - ((tags-todo "+PRIORITY<=\"B\""))) - ("pc" "Priority >= C" - ((tags-todo "+PRIORITY<=\"C\""))) - ("qd" "TODO entries sort by closed time" + ("pb" "Priority >= B" + ((tags-todo "+PRIORITY<=\"B\""))) + ("pc" "Priority >= C" + ((tags-todo "+PRIORITY<=\"C\""))) + ("qd" "TODO entries sort by closed time" ((org-ql-block '(closed) ((org-ql-block-header "Closed TODOs") (org-ql-sort '(closed)) (org-super-agenda-groups '((:auto-ts t))))))) - ("qS" "SOMEDAYs" + ("qS" "SOMEDAYs" ((org-ql-block '(todo "SOMEDAY") ((org-ql-block-header "SOMEDAYs") (org-ql-sort '(start-time)) (org-super-agenda-groups '((:auto-ts t))))))) - ("qs" "STARTEDs" + ("qs" "STARTEDs" ((org-ql-block '(todo "STARTED") ((org-ql-block-header "STARTEDs") (org-ql-sort '(start-time)) (org-super-agenda-groups '((:auto-ts t))))))) - ("qt" "TODOs sort by start time" + ("qt" "TODOs sort by start time" ((org-ql-block '(todo) ((org-ql-block-header "TODOs") (org-ql-sort '(start-time)) @@ -380,8 +382,8 @@ See `org-capture-templates' for more information." (message "Pushing to remote...") (let ((exit-code (eshell-command "git push"))) (if (eq exit-code t) - (message "Push may have failed or nothing to push, check *Messages* buffer for details") - (message "Push successfully %s" timestamp))))) + (message "Push may have failed or nothing to push, check *Messages* buffer for details") + (message "Push successfully %s" timestamp))))) ;; 预览博客 (defun my-blog-preview () diff --git a/lisp/init-package.el b/lisp/init-package.el index b8bb6be..3ef7db4 100644 --- a/lisp/init-package.el +++ b/lisp/init-package.el @@ -6,22 +6,20 @@ (setopt use-package-enable-imenu-support t) -;; 安装gcmh用于管理内存回收 -(use-package gcmh - :demand t - :init - (setq gcmh-idle-delay 'auto - gcmh-auto-idle-delay-factor 10 - gcmh-high-cons-threshold #x4000000) - :config - (gcmh-mode 1)) - ;; restart-emacs (use-package restart-emacs) +;; async +(use-package async + :init + (dired-async-mode) + (async-bytecomp-package-mode 1) + (setq async-bytecomp-allowed-packages '(all))) + ;; 安装multiple-cursors (use-package multiple-cursors - :config (setq mc/insert-numbers-default 1)) + :config + (setq mc/insert-numbers-default 1)) ;; 安装crux,增强快捷键,快捷键配置在init-kbd.el中 (use-package crux) @@ -34,6 +32,7 @@ ;; 安装which-key,快捷键提示 (use-package which-key + :delight :defer 0 :config (which-key-mode)) @@ -43,20 +42,22 @@ ;; 安装vertico (use-package vertico - :init (vertico-mode)) + :init + (vertico-mode)) ;; 安装orderless,用于模糊搜索 (use-package orderless - :custom (completion-styles '(orderless basic))) + :custom + (completion-styles '(orderless basic))) ;; 安装marginalia,用于命令注释 (use-package marginalia - :init (marginalia-mode)) + :init + (marginalia-mode)) ;; 安装consult,增强搜索和其他菜单 (use-package consult :config - ;; everything (when *is-windows* (setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk)) @@ -75,7 +76,8 @@ ;; embark (use-package embark - :config (setq prefix-help-command 'embark-prefix-help-command) + :config + (setq prefix-help-command 'embark-prefix-help-command) :init (defun my/embark-preview () "Previews candidate in vertico buffer, unless it's a consult command." @@ -141,44 +143,58 @@ targets." ;; wgrep (use-package wgrep) +;; anzu +(use-package anzu + :delight + :init + (global-anzu-mode)) + ;; 启用savehist,保存命令顺序 (use-package savehist - :init (setq enable-recursive-minibuffers t - history-length 50 - savehist-additional-variables '(mark-ring - global-mark-ring - search-ring - regexp-search-ring - extended-command-history) - savehist-autosave-interval 300) + :init + (setq enable-recursive-minibuffers t + history-length 50 + savehist-additional-variables '(mark-ring + global-mark-ring + search-ring + regexp-search-ring + extended-command-history) + savehist-autosave-interval 300) (savehist-mode)) ;; saveplace,保存光标位置 (use-package saveplace - :init (save-place-mode)) + :init + (save-place-mode)) ;; undo增强 (use-package undo-fu) (use-package undo-fu-session - :init (undo-fu-session-global-mode)) + :init + (undo-fu-session-global-mode)) ;; vundo,撤回树 (use-package vundo - :init (setq undo-limit 800000 - undo-strong-limit 1200000 - undo-outer-limit 12000000)) + :init + (setq undo-limit 800000 + undo-strong-limit 1200000 + undo-outer-limit 12000000)) ;; expand-region,快速展开选中 (use-package expand-region) ;; projectile (use-package projectile - :init (projectile-mode) - :bind (:map projectile-mode-map - ("C-x p" . projectile-command-map) - ("C-x p b" . consult-project-buffer)) - :config (setq projectile-enable-caching t)) + :delight + :init + (projectile-mode) + :bind + (:map projectile-mode-map + ("C-x p" . projectile-command-map) + ("C-x p b" . consult-project-buffer)) + :config + (setq projectile-enable-caching t)) (use-package ibuffer-projectile :init (add-hook 'ibuffer-hook @@ -189,19 +205,27 @@ targets." ;; avy中文支持 (use-package ace-pinyin - :init (ace-pinyin-global-mode +1)) + :delight + :init + (ace-pinyin-global-mode +1)) ;; avy-zap (use-package avy-zap - :bind (("M-z" . avy-zap-to-char-dwim) - ("M-Z" . avy-zap-up-to-char-dwim))) + :bind + (("M-z" . avy-zap-to-char-dwim) + ("M-Z" . avy-zap-up-to-char-dwim))) ;; jinx,拼写检查 (unless *is-windows* (use-package jinx - :hook (org-mode-hook . jinx-mode) - :bind ([remap ispell-word] . jinx-correct) - :config (setq jinx-languages "en_US") + :delight + (jinx-mode " Jinx" jinx) + :hook + (org-mode-hook . jinx-mode) + :bind + ([remap ispell-word] . jinx-correct) + :config + (setq jinx-languages "en_US") (add-to-list 'jinx-exclude-regexps '(t "\\cc")) (with-eval-after-load 'jinx (dolist (range '((#x4E00 . #x9FFF) @@ -219,8 +243,9 @@ targets." (use-package flycheck) (use-package flycheck-guile - :hook (scheme-mode . (lambda () - (require 'flycheck-guile)))) + :hook + (scheme-mode . (lambda () + (require 'flycheck-guile)))) ;; consult-flycheck (use-package consult-flycheck) @@ -231,27 +256,31 @@ targets." ;; eat (use-package eat - :straight (eat :type git - :host codeberg - :repo "akib/emacs-eat" - :files ("*.el" - ("term" "term/*.el") - "*.texi" - "*.ti" - ("terminfo/e" "terminfo/e/*") - ("terminfo/65" "terminfo/65/*") - ("integration" "integration/*") - (:exclude ".dir-locals.el" "*-tests.el"))) - :hook ((eshell-load . eat-eshell-mode) - (eshell-load . eat-eshell-visual-command-mode)) - :config (setq eat-term-terminfo-directory eat--terminfo-path)) + :straight + (eat :type git + :host codeberg + :repo "akib/emacs-eat" + :files ("*.el" + ("term" "term/*.el") + "*.texi" + "*.ti" + ("terminfo/e" "terminfo/e/*") + ("terminfo/65" "terminfo/65/*") + ("integration" "integration/*") + (:exclude ".dir-locals.el" "*-tests.el"))) + :hook + ((eshell-load . eat-eshell-mode) + (eshell-load . eat-eshell-visual-command-mode)) + :config + (setq eat-term-terminfo-directory eat--terminfo-path)) ;; general (use-package general) ;; hydra (use-package hydra - :defines (consult-imenu-config) + :defines + (consult-imenu-config) :init (with-eval-after-load 'consult-imenu (setq consult-imenu-config diff --git a/lisp/init-prog.el b/lisp/init-prog.el index eccbb49..85fbd80 100644 --- a/lisp/init-prog.el +++ b/lisp/init-prog.el @@ -6,7 +6,6 @@ ;; tree-sitter (use-package treesit-auto - :demand t :config (setq treesit-auto-install 'prompt) (global-treesit-auto-mode)