From 2162b34007e9e6a9b4efa2bd0040dec12030e76e Mon Sep 17 00:00:00 2001 From: andsy10 Date: Mon, 4 May 2026 12:01:25 +0800 Subject: [PATCH] Config: Strip down and simplify Emacs config - Remove consult-dir, nerd-icons-completion, org-contrib and some other unused package - Delete init-org-refile.el and related keybindings - Prune EMMS config - Remove EXWM flatpak launcher helpers (vscodium, localsend, steam) - Extract Windows dirvish video preview fix to standalone module - Drop built-in settings moved elsewhere (startup defaults, whitespace, etc.) - Clean up trailing whitespace / process list prettify configs --- init.el | 1 - lisp/fix-dirvish-preview.el | 44 ++++++++++++ lisp/init-completion.el | 16 +---- lisp/init-const.el | 52 +++++++------- lisp/init-dired.el | 37 +--------- lisp/init-emms.el | 50 ------------- lisp/init-exwm.el | 15 ---- lisp/init-kbd-func.el | 2 +- lisp/init-kbd.el | 4 +- lisp/init-org-refile.el | 140 ------------------------------------ lisp/init-org.el | 14 +--- lisp/init-package.el | 76 +++++--------------- lisp/init-prog.el | 3 +- lisp/init-startup.el | 17 ----- lisp/init-terminal-kbd.el | 22 ++---- 15 files changed, 102 insertions(+), 391 deletions(-) create mode 100644 lisp/fix-dirvish-preview.el delete mode 100644 lisp/init-org-refile.el diff --git a/init.el b/init.el index 275ae82..8caf8a8 100644 --- a/init.el +++ b/init.el @@ -40,7 +40,6 @@ (require 'init-startup) (require 'init-elpa) (require 'init-terminal-package) - (require 'init-prog) (require 'init-terminal-ui) (require 'init-terminal-kbd) (require 'init-segmentation))) diff --git a/lisp/fix-dirvish-preview.el b/lisp/fix-dirvish-preview.el new file mode 100644 index 0000000..4125110 --- /dev/null +++ b/lisp/fix-dirvish-preview.el @@ -0,0 +1,44 @@ +;;; fix-dirvish-preview.el --- fix dirvish preview on windows -*- lexical-binding: t -*- + +;;; Commentary: + +;;; Code: + +;; Fix video-mtn preview issue on Windows +;; The problem: mtn generates thumbnails with filename like "video.mp4.jpg", +;; but dirvish expects MD5-based filename like "a1b2c3d4.jpg" +(with-eval-after-load 'dirvish + ;; Function to find mtn output file for a given video file in cache directory + (defun my/dirvish-find-mtn-output (video-file cache-dir ext) + "Find mtn-generated thumbnail for VIDEO-FILE in CACHE-DIR with extension EXT." + (let* ((file-base (file-name-base video-file)) + ;; mtn generates: [filename].[ext].jpg + (mtn-pattern (format "%s.%s.jpg" (regexp-quote file-base) ext)) + (files (directory-files cache-dir t mtn-pattern))) + (car files))) + + ;; Advice to fix the sentinel after mtn generates the thumbnail + (defun my/dirvish-media--cache-sentinel-advice (orig-fun proc exit-code) + "Advice to rename mtn output to MD5 format after generation." + (let* ((video-path (process-get proc 'path)) + (ext (downcase (or (file-name-extension video-path) ""))) + (dv (dirvish-curr))) + (when (and (memq system-type '(ms-dos windows-nt)) + (member ext dirvish-video-exts) + dv) + ;; Try to find and rename mtn output to MD5 format + (let* ((width (dirvish-media--img-size (dv-preview-window dv))) + (cache (dirvish--img-thumb-name video-path width ".jpg")) + (cache-dir (dirvish--get-parent-path cache)) + (mtn-file (my/dirvish-find-mtn-output video-path cache-dir ext))) + (when (and mtn-file (file-exists-p mtn-file) (not (file-exists-p cache))) + (rename-file mtn-file cache))))) + ;; Call original function + (funcall orig-fun proc exit-code)) + + ;; Apply advice + (advice-add 'dirvish-media--cache-sentinel :around #'my/dirvish-media--cache-sentinel-advice)) + +(provide 'fix-dirvish-preview) + +;;; fix-dirvish-preview.el ends here diff --git a/lisp/init-completion.el b/lisp/init-completion.el index 8f44853..6636b3d 100644 --- a/lisp/init-completion.el +++ b/lisp/init-completion.el @@ -24,7 +24,7 @@ ;; corfu (use-package corfu :autoload (corfu-quit consult-completion-in-region) - :functions (persistent-scratch-save corfu-move-to-minibuffer) + :functions (persistent-scratch-save) :custom (corfu-auto t) (corfu-auto-prefix 2) @@ -48,17 +48,6 @@ (add-hook 'before-save-hook #'corfu-quit) (advice-add #'persistent-scratch-save :before #'corfu-quit) - ;; Move completions to minibuffer - (defun corfu-move-to-minibuffer () - (interactive) - (pcase completion-in-region--data - (`(,beg ,end ,table ,pred ,extras) - (let ((completion-extra-properties extras) - completion-cycle-threshold completion-cycling) - (consult-completion-in-region beg end table pred))))) - (keymap-set corfu-map "M-m" #'corfu-move-to-minibuffer) - (add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer) - :bind (:map corfu-map ("RET" . nil))) @@ -73,9 +62,6 @@ (setq-local corfu-auto nil) (local-set-key (kbd "TAB") 'completion-at-point))) -(use-package nerd-icons-completion - :hook (marginalia-mode . nerd-icons-completion-marginalia-setup)) - (use-package emacs :custom (tab-always-indent 'complete) diff --git a/lisp/init-const.el b/lisp/init-const.el index 81bb4da..e7ce84d 100644 --- a/lisp/init-const.el +++ b/lisp/init-const.el @@ -10,35 +10,33 @@ (defconst *is-windows* (or (eq system-type 'ms-dos) (eq system-type 'windows-nt))) -;; Windows 系统编码设置 -(when *is-windows* - ;; 设置默认编码环境 - (set-language-environment "UTF-8") - (prefer-coding-system 'utf-8) - (set-default-coding-systems 'utf-8) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) - (setq default-buffer-file-coding-system 'utf-8) - - ;; 设置进程通信编码 - (setq default-process-coding-system '(utf-8 . utf-8)) - - ;; 为特定程序设置编码 - (if *is-windows* - (progn - (add-to-list 'process-coding-system-alist '("rg" utf-8 . gbk)) - (add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . gbk))) +(if *is-windows* (progn - (add-to-list 'process-coding-system-alist '("rg" utf-8 . utf-8)) - (add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . utf-8)))) - (add-to-list 'process-coding-system-alist '("grep" utf-8 . utf-8)) - (add-to-list 'process-coding-system-alist '("find" utf-8 . utf-8)) - (add-to-list 'process-coding-system-alist '("fd" utf-8 . utf-8)) - (add-to-list 'process-coding-system-alist '("fdfind" utf-8 . utf-8)) + ;; 设置默认编码环境 + (set-language-environment "UTF-8") + (prefer-coding-system 'utf-8) + (set-default-coding-systems 'utf-8) + (set-terminal-coding-system 'utf-8) + (set-keyboard-coding-system 'utf-8) + (setq default-buffer-file-coding-system 'utf-8) - ;; Windows 文件名 Unicode 支持 - (setq w32-unicode-filenames t) - (setq w32-system-coding-system 'utf-8)) + ;; 设置进程通信编码 + (setq default-process-coding-system '(utf-8 . utf-8)) + + ;; Windows 文件名 Unicode 支持 + (setq w32-unicode-filenames t) + (setq w32-system-coding-system 'utf-8) + + ;; 为特定程序设置编码 + (add-to-list 'process-coding-system-alist '("rg" utf-8 . gbk)) + (add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . gbk))) + (progn + (add-to-list 'process-coding-system-alist '("rg" utf-8 . utf-8)) + (add-to-list 'process-coding-system-alist '("ripgrep" utf-8 . utf-8)))) +(add-to-list 'process-coding-system-alist '("grep" utf-8 . utf-8)) +(add-to-list 'process-coding-system-alist '("find" utf-8 . utf-8)) +(add-to-list 'process-coding-system-alist '("fd" utf-8 . utf-8)) +(add-to-list 'process-coding-system-alist '("fdfind" utf-8 . utf-8)) (provide 'init-const) diff --git a/lisp/init-dired.el b/lisp/init-dired.el index 49658a2..52e173c 100644 --- a/lisp/init-dired.el +++ b/lisp/init-dired.el @@ -12,6 +12,8 @@ (dirvish-override-dired-mode) :config + (if *is-windows* (require 'fix-dirvish-preview)) + (if *is-mac* (setq dirvish-hide-details t) (setq dirvish-hide-details '(dirvish-side))) @@ -68,41 +70,6 @@ "-l --almost-all --human-readable --group-directories-first --no-group") (put 'dired-find-alternate-file 'disabled nil) -;; Fix video-mtn preview issue on Windows -;; The problem: mtn generates thumbnails with filename like "video.mp4.jpg", -;; but dirvish expects MD5-based filename like "a1b2c3d4.jpg" -(with-eval-after-load 'dirvish - ;; Function to find mtn output file for a given video file in cache directory - (defun my/dirvish-find-mtn-output (video-file cache-dir ext) - "Find mtn-generated thumbnail for VIDEO-FILE in CACHE-DIR with extension EXT." - (let* ((file-base (file-name-base video-file)) - ;; mtn generates: [filename].[ext].jpg - (mtn-pattern (format "%s.%s.jpg" (regexp-quote file-base) ext)) - (files (directory-files cache-dir t mtn-pattern))) - (car files))) - - ;; Advice to fix the sentinel after mtn generates the thumbnail - (defun my/dirvish-media--cache-sentinel-advice (orig-fun proc exit-code) - "Advice to rename mtn output to MD5 format after generation." - (let* ((video-path (process-get proc 'path)) - (ext (downcase (or (file-name-extension video-path) ""))) - (dv (dirvish-curr))) - (when (and (memq system-type '(ms-dos windows-nt)) - (member ext dirvish-video-exts) - dv) - ;; Try to find and rename mtn output to MD5 format - (let* ((width (dirvish-media--img-size (dv-preview-window dv))) - (cache (dirvish--img-thumb-name video-path width ".jpg")) - (cache-dir (dirvish--get-parent-path cache)) - (mtn-file (my/dirvish-find-mtn-output video-path cache-dir ext))) - (when (and mtn-file (file-exists-p mtn-file) (not (file-exists-p cache))) - (rename-file mtn-file cache))))) - ;; Call original function - (funcall orig-fun proc exit-code)) - - ;; Apply advice - (advice-add 'dirvish-media--cache-sentinel :around #'my/dirvish-media--cache-sentinel-advice)) - (provide 'init-dired) ;;; init-dired.el ends here diff --git a/lisp/init-emms.el b/lisp/init-emms.el index 078e87b..702835f 100644 --- a/lisp/init-emms.el +++ b/lisp/init-emms.el @@ -71,43 +71,6 @@ (require 'emms-playing-time) (emms-playing-time-mode 1) - ;; 歌词设置 - (require 'emms-lyrics) - (setq emms-lyrics-display-on-modeline t) ; 在模式行显示歌词 - (setq emms-lyrics-display-on-minibuffer nil) ; 不在 minibuffer 显示 - (setq emms-lyrics-display-buffer nil) ; 不使用专用缓冲区 - (setq emms-lyrics-scroll-p t) ; 启用歌词滚动 - (setq emms-lyrics-scroll-timer-interval 0.4) ; 滚动间隔 - (setq emms-lyrics-dir "~/Music/lyrics") ; 歌词文件目录 - (setq emms-lyrics-display-format " %s ") ; 歌词显示格式 - (emms-lyrics 1) ; 启用歌词显示 - - ;; 浏览器设置 - (require 'emms-browser) - (setq emms-browser-default-browse-type 'artist) - (setq emms-browser-covers nil) ; 禁用封面 - - ;; 浏览器显示格式 - (setq emms-browser-info-title-format "%i%n") - (setq emms-browser-playlist-info-title-format "%i%n") - - ;; 添加浏览器快捷键 - (define-key emms-browser-mode-map (kbd "SPC") 'emms-browser-add-tracks-and-play) - - ;; 缓存设置 - (require 'emms-cache) - (emms-cache 1) ; 启用缓存 - - ;; 历史记录 - (require 'emms-history) - (add-hook 'emms-player-started-hook #'emms-last-played-update-current) - - ;; 音量控制 - (require 'emms-volume) - ;; 在播放列表中使用 +/- 控制音量 - (define-key emms-playlist-mode-map (kbd "+") #'emms-volume-raise) - (define-key emms-playlist-mode-map (kbd "-") #'emms-volume-lower) - ;; 添加(playlist中的)快捷键 (define-key emms-playlist-mode-map (kbd "SPC") 'emms-pause) (define-key emms-playlist-mode-map (kbd "N") 'emms-next) @@ -115,23 +78,10 @@ (define-key emms-playlist-mode-map (kbd "R") 'emms-random) (define-key emms-playlist-mode-map (kbd "/") 'emms-playlist-limit) - ;; 启用标记功能 - (require 'emms-mark) - ;; 启用播放列表排序 (require 'emms-playlist-sort) (define-key emms-playlist-mode-map (kbd "S s") 'emms-playlist-sort-map) - ;; 启用播放列表限制/过滤 - (require 'emms-playlist-limit) - - ;; 启用标签编辑器 - (require 'emms-tag-editor) - - ;; 启用评分系统 - (require 'emms-score) - (emms-score 1) - ;; 启动后自动恢复播放列表 ;; (add-hook 'after-init-hook 'emms-history-load) diff --git a/lisp/init-exwm.el b/lisp/init-exwm.el index c20889e..fa49120 100644 --- a/lisp/init-exwm.el +++ b/lisp/init-exwm.el @@ -102,21 +102,6 @@ (desktop-environment-screenshot-partial-command "import ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png")) - (defun vscodium () - "Run VSCodium via shell command asynchronously." - (interactive) - (start-process-shell-command "vscodium" nil "flatpak run com.vscodium.codium")) - - (defun localsend () - "Run localsend via shell command asynchronously." - (interactive) - (start-process-shell-command "localsend" nil "flatpak run org.localsend.localsend_app")) - - (defun steam () - "Run Steam via shell command asynchronously." - (interactive) - (start-process-shell-command "steam" nil "flatpak run com.valvesoftware.Steam")) - (add-hook 'exwm-init-hook (lambda () (unless (zerop (shell-command "pgrep -x fcitx5")) diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el index 6665d5d..7ecdf59 100644 --- a/lisp/init-kbd-func.el +++ b/lisp/init-kbd-func.el @@ -105,7 +105,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog (switch-to-buffer "*EMMS Playlist*")) (defun my/dired-next-line() - "move to forward line in dired buffer" + "Move to forward line in dired buffer" (interactive) (forward-line 1) (dired-move-to-filename)) diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el index 936217c..7c1288a 100644 --- a/lisp/init-kbd.el +++ b/lisp/init-kbd.el @@ -30,7 +30,8 @@ "b" 'indent-bars-mode "t" 'consult-theme "c" 'my-color-picker - "f" 'describe-face) + "f" 'describe-face + "R" 'rainbow-delimiters-mode) ;; f for find and consult command (general-def @@ -144,7 +145,6 @@ (general-def org-mode-map "C-" 'org-cycle-parent-subtree "C-c i" 'consult-outline - "C-c o w" 'my-org-refile-to-new-file "C-c o l" 'org-toggle-link-display "C-c C-k" 'kmacro-call-macro "M-{" 'org-previous-visible-heading diff --git a/lisp/init-org-refile.el b/lisp/init-org-refile.el deleted file mode 100644 index 7f4bbc4..0000000 --- a/lisp/init-org-refile.el +++ /dev/null @@ -1,140 +0,0 @@ -;;; init-org-refile.el --- org-refile config -*- lexical-binding: t -*- - -;;; Commentary: - -;;; Code: - -(defun my-org-refile-to-new-file () - "org-refile as a separate org file with custom template." - (interactive) - (require 'org-element) - (org-back-to-heading t) - - (let* ((heading-components (org-heading-components)) - ;; (todo (nth 2 heading-components)) ; 保留todo状态 - (raw-title (nth 4 heading-components)) ; 纯标题文本 - (tags (org-get-tags nil t)) - (begin (point)) - (end (save-excursion (org-end-of-subtree t t) (point))) - (original-content (buffer-substring begin end)) - - ;; 检测原条目是否有属性,不包括logbook - (has-properties-p - (with-temp-buffer - (insert original-content) - (goto-char (point-min)) - (forward-line 1) ; 跳过headline - (looking-at org-property-drawer-re))) - - ;; 如果有属性则提取内容 - (original-props - (when has-properties-p - (with-temp-buffer - (insert original-content) - (goto-char (point-min)) - (forward-line 1) - (let ((start (point))) - (when (re-search-forward ":END:" nil t) - (forward-line 1) - (buffer-substring start (point))))))) - - ;; 询问文件名,保留中文,只替换空格和特殊字符 - (default-name (replace-regexp-in-string "[ \\/:*?\"<>|]" "_" raw-title)) - (user-filename (read-string "Filename (without .org): " default-name)) - - (filename (format "%s-%s.org" - (format-time-string "%Y%m%d") - user-filename)) - (target-dir (if *is-windows* - "h:/emacs/my-org-note/" - "~/org/my-org-note/")) - (filepath (expand-file-name filename target-dir)) - - ;; 询问category - (category (completing-read "Category: " - '("none" "note" "project") - nil t "project")) - - ;; 询问 Tags(原有标签作为默认值) - (tag-input (read-string "Tags (space separated): " - (mapconcat #'identity tags " "))) - - (formatted-tags - (if (and tag-input (not (string= tag-input ""))) - (concat ":" (replace-regexp-in-string " " ":" tag-input) ":") - "")) - - ;; 提取body - (body - (with-temp-buffer - (insert original-content) - (goto-char (point-min)) - (forward-line 1) - - ;; 如果有属性抽屉则跳过 - (when (looking-at org-property-drawer-re) - (while (not (looking-at org-property-end-re)) - (forward-line 1)) - (forward-line 1)) - - ;; 跳过schedule和deadline - ;; (when (looking-at org-planning-line-re) - ;; (forward-line 1)) - - ;; 清理开头的空行 - (skip-chars-forward "\n") - (buffer-substring (point) (point-max))))) - - ;; 检查文件是否存在 - (when (and (file-exists-p filepath) - (not (y-or-n-p (format "File %s exists. Overwrite? " filename)))) - (error "Refile canceled")) - - (unless (file-exists-p target-dir) - (make-directory target-dir t)) - - ;; 将原条目的TODO关键字改为COMMENT(如果有) - (let ((todo (nth 2 heading-components))) - (when todo - (save-excursion - (goto-char begin) - (when (re-search-forward (concat "^\\(\\*+ \\s-*\\)" (regexp-quote todo)) (save-excursion (forward-line 1) (point)) t) - (replace-match "\\1COMMENT" t nil))))) - - ;; 创建新文件 - (condition-case err - (with-temp-file filepath - ;; 文件头 - (insert (format "#+title: %s\n" user-filename)) - (insert (format "#+date: %s\n" (format-time-string "[%Y-%m-%d %a %H:%M]"))) - (insert (format "#+category: %s\n" category)) - (insert "#+STARTUP: content\n\n") - - ;; 插入标题和tag - (insert (format "* STARTED %s :root%s\n" - ;; (if todo (concat todo " ") "") - user-filename - formatted-tags)) - - ;; 只有原条目有属性时才插入 - (when original-props - (insert original-props)) - - ;; 插入body - (insert body) - - ;; 确保格式正确,添加文件尾局部变量 - (unless (bolp) (insert "\n")) - (insert "\n# Local Variables:\n# org-use-tag-inheritance: nil\n# End:\n")) - - (error - (goto-char begin) - (insert original-content) - (error "Failed to create file: %s" err))) - - (find-file-other-window filepath) - (message "Successfully refiled to %s" filepath))) - -(provide 'init-org-refile) - -;;; init-org-refile.el ends here diff --git a/lisp/init-org.el b/lisp/init-org.el index 108bcc0..cfcea23 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -10,7 +10,6 @@ (add-hook 'org-mode-hook (lambda () (require 'org-tempo) - (require 'init-org-refile) (org-indent-mode) (visual-line-mode) (setq-local electric-pair-inhibit-predicate @@ -43,7 +42,7 @@ ;; 设置todo关键字 (setq org-todo-keywords (quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)") - (sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING(m)" "PHONE(p)")))) + (sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)")))) ;; agenda相关 (with-eval-after-load 'recentf @@ -84,15 +83,6 @@ 'org-babel-load-languages org-babel-load-languages)) -;; org-contrib 和 org-checklist -(use-package org-contrib - :straight (org-contrib :type git :host github :repo "emacsmirror/org-contrib" - :depth 1) - :config - (add-hook 'org-mode-hook - (lambda () - (require 'org-checklist nil t)))) - ;; org-download (use-package org-download :config @@ -218,7 +208,7 @@ :config (org-super-agenda-mode)) -;; 自定义已完成任务视图 +;; 自定义agenda视图 (setq org-agenda-custom-commands '(("pa" "Priority >= A" ((tags-todo "+PRIORITY=\"A\""))) diff --git a/lisp/init-package.el b/lisp/init-package.el index 83a3388..4f66c84 100644 --- a/lisp/init-package.el +++ b/lisp/init-package.el @@ -16,45 +16,7 @@ :config (gcmh-mode 1)) -(use-package emacs - :hook (((prog-mode markdown-mode conf-mode) . enable-trailing-whitespace)) - :init - (setq kill-whole-line t ; Kill line including '\n' - line-move-visual nil - track-eol t ; Keep cursor at end of lines. Require line-move-visual is nil. - set-mark-command-repeat-pop t) ; Repeating C-SPC after popping mark pops it again - - ;; Visualize TAB, (HARD) SPACE, NEWLINE - (setq-default show-trailing-whitespace nil) ; Don't show trailing whitespace by default - (defun enable-trailing-whitespace () - "Show trailing spaces and delete on saving." - (setq show-trailing-whitespace t) - (add-hook 'before-save-hook #'delete-trailing-whitespace nil t)) - - ;; Prettify the process list - (with-no-warnings - (defun my/list-processes--prettify () - "Prettify process list." - (when-let* ((entries tabulated-list-entries)) - (setq tabulated-list-entries nil) - (dolist (p (process-list)) - (when-let* ((val (cadr (assoc p entries))) - (name (aref val 0)) - (pid (aref val 1)) - (status (aref val 2)) - (status (list status - 'face - (if (memq status '(stop exit closed failed)) - 'error - 'success))) - (buf-label (aref val 3)) - (tty (list (aref val 4) 'face 'font-lock-doc-face)) - (thread (list (aref val 5) 'face 'font-lock-doc-face)) - (cmd (list (aref val 6) 'face 'completions-annotations))) - (push (list p (vector name pid status buf-label tty thread cmd)) - tabulated-list-entries))))) - (advice-add #'list-processes--refresh :after #'my/list-processes--prettify))) - +;; restart-emacs (use-package restart-emacs) ;; 安装multiple-cursors @@ -99,6 +61,7 @@ (default-directory "~/")) (consult-fd))) + ;; everything (when *is-windows* (setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk)) (setq consult-ripgrep-args (encode-coding-string @@ -106,18 +69,9 @@ 'gbk)) (add-to-list 'process-coding-system-alist '("es" gbk . gbk))) + ;; mdfind (when *is-mac* - (setopt consult-locate-args "mdfind -name")) - - (delete 'consult-source-recent-file consult-buffer-sources)) - -(use-package consult-dir - :bind (("C-x C-d" . consult-dir) - :map minibuffer-local-completion-map - ("C-x C-d" . consult-dir) - ("C-x C-j" . consult-dir-jump-file)) - :config - (delete 'consult-dir--source-recentf consult-dir-sources)) + (setopt consult-locate-args "mdfind -name"))) (use-package consult-notes :config @@ -182,11 +136,10 @@ targets." (advice-add #'embark-completing-read-prompter :around #'embark-hide-which-key-indicator)))) -;; 安装embark-consult和wgrep -(use-package embark-consult) -(use-package wgrep) - -(with-eval-after-load +;; embark-consult +(use-package embark-consult + :config + (with-eval-after-load 'consult '(with-eval-after-load 'embark @@ -194,7 +147,10 @@ targets." (require 'embark-consult) (add-hook 'embark-collect-mode-hook - #'consult-preview-at-point-mode)))) + #'consult-preview-at-point-mode))))) + +;; wgrep +(use-package wgrep) ;; 启用savehist,保存命令顺序 (use-package savehist @@ -218,7 +174,7 @@ targets." (use-package undo-fu-session :init (undo-fu-session-global-mode)) -;; vundop,撤回树 +;; vundo,撤回树 (use-package vundo :init (setq undo-limit 800000 undo-strong-limit 1200000 @@ -231,7 +187,8 @@ targets." (use-package projectile :init (projectile-mode) :bind (:map projectile-mode-map - ("C-x p" . projectile-command-map)) + ("C-x p" . projectile-command-map) + ("C-x p b" . consult-project-buffer)) :config (setq projectile-enable-caching t)) (use-package ibuffer-projectile @@ -283,6 +240,9 @@ targets." (unless *is-windows* (use-package vterm)) +;; eat +(use-package eat) + ;; general (use-package general) diff --git a/lisp/init-prog.el b/lisp/init-prog.el index 9d87651..cb27a2f 100644 --- a/lisp/init-prog.el +++ b/lisp/init-prog.el @@ -27,6 +27,8 @@ (with-eval-after-load 'geiser (setq geiser-default-implementation 'guile))) +(use-package geiser-guile) + ;; markdown (use-package markdown-mode :mode ("README\\.md\\'" . gfm-mode) @@ -34,7 +36,6 @@ :bind (:map markdown-mode-map ("C-c C-e" . markdown-do))) -(use-package geiser-guile) (provide 'init-prog) diff --git a/lisp/init-startup.el b/lisp/init-startup.el index 5dd4b99..bcc2fe9 100644 --- a/lisp/init-startup.el +++ b/lisp/init-startup.el @@ -90,23 +90,6 @@ (if (boundp 'use-short-answers) (setq use-short-answers t) (fset 'yes-or-no-p 'y-or-n-p)) -(setq-default major-mode 'text-mode - fill-column 100 - tab-width 4 - indent-tabs-mode nil) - -(setq visible-bell t - inhibit-compacting-font-caches t ; Don’t compact font caches during GC - delete-by-moving-to-trash t ; Deleting files go to OS's trash folder - ;; make-backup-files nil ; Forbide to make backup files - ;; auto-save-default nil ; Disable auto save - - uniquify-buffer-name-style 'post-forward-angle-brackets ; Show path if names are same - adaptive-fill-regexp "[ t]+|[ t]*([0-9]+.|*+)[ t]*" - adaptive-fill-first-line-regexp "^* *$" - sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*" - sentence-end-double-space nil - word-wrap-by-category t) (provide 'init-startup) diff --git a/lisp/init-terminal-kbd.el b/lisp/init-terminal-kbd.el index dd9729e..42ab41f 100644 --- a/lisp/init-terminal-kbd.el +++ b/lisp/init-terminal-kbd.el @@ -4,11 +4,6 @@ ;;; Code: -;; 修改mac键位 -(when *is-mac* - (setq mac-command-modifier 'meta) - (setq mac-option-modifier 'none)) - (defun open-init-file() "Open user's init.el file in ~/.emacs.d ." (interactive) @@ -32,20 +27,13 @@ (general-def "C-c " 'scratch-buffer) (general-def "C-c " 'scratch-buffer)) -;; markdown -(general-def markdown-mode-map - "M-p" nil - "M-n" nil) - ;; org-mode (general-def org-mode-map - "C-" 'org-cycle-current-subtree - "C-c o l" 'org-toggle-link-display) - -;; vterm -(general-def vterm-mode-map - "M-]" nil - "C-q" 'vterm-send-next-key) + "C-" 'org-cycle-parent-subtree + "C-c o l" 'org-toggle-link-display + "C-c C-k" 'kmacro-call-macro + "M-{" 'org-previous-visible-heading + "M-}" 'org-next-visible-heading) ;; global map with C-c prefix (general-def