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
This commit is contained in:
2026-05-04 12:01:25 +08:00
parent 1a941344bf
commit 2162b34007
15 changed files with 102 additions and 391 deletions

View File

@@ -40,7 +40,6 @@
(require 'init-startup) (require 'init-startup)
(require 'init-elpa) (require 'init-elpa)
(require 'init-terminal-package) (require 'init-terminal-package)
(require 'init-prog)
(require 'init-terminal-ui) (require 'init-terminal-ui)
(require 'init-terminal-kbd) (require 'init-terminal-kbd)
(require 'init-segmentation))) (require 'init-segmentation)))

View File

@@ -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

View File

@@ -24,7 +24,7 @@
;; corfu ;; corfu
(use-package corfu (use-package corfu
:autoload (corfu-quit consult-completion-in-region) :autoload (corfu-quit consult-completion-in-region)
:functions (persistent-scratch-save corfu-move-to-minibuffer) :functions (persistent-scratch-save)
:custom :custom
(corfu-auto t) (corfu-auto t)
(corfu-auto-prefix 2) (corfu-auto-prefix 2)
@@ -48,17 +48,6 @@
(add-hook 'before-save-hook #'corfu-quit) (add-hook 'before-save-hook #'corfu-quit)
(advice-add #'persistent-scratch-save :before #'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 :bind (:map corfu-map
("RET" . nil))) ("RET" . nil)))
@@ -73,9 +62,6 @@
(setq-local corfu-auto nil) (setq-local corfu-auto nil)
(local-set-key (kbd "TAB") 'completion-at-point))) (local-set-key (kbd "TAB") 'completion-at-point)))
(use-package nerd-icons-completion
:hook (marginalia-mode . nerd-icons-completion-marginalia-setup))
(use-package emacs (use-package emacs
:custom :custom
(tab-always-indent 'complete) (tab-always-indent 'complete)

View File

@@ -10,35 +10,33 @@
(defconst *is-windows* (or (eq system-type 'ms-dos) (defconst *is-windows* (or (eq system-type 'ms-dos)
(eq system-type 'windows-nt))) (eq system-type 'windows-nt)))
;; Windows 系统编码设置 (if *is-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)))
(progn (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)))) (set-language-environment "UTF-8")
(add-to-list 'process-coding-system-alist '("grep" utf-8 . utf-8)) (prefer-coding-system 'utf-8)
(add-to-list 'process-coding-system-alist '("find" utf-8 . utf-8)) (set-default-coding-systems 'utf-8)
(add-to-list 'process-coding-system-alist '("fd" utf-8 . utf-8)) (set-terminal-coding-system 'utf-8)
(add-to-list 'process-coding-system-alist '("fdfind" utf-8 . utf-8)) (set-keyboard-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
;; Windows 文件名 Unicode 支持 ;; 设置进程通信编码
(setq w32-unicode-filenames t) (setq default-process-coding-system '(utf-8 . utf-8))
(setq w32-system-coding-system '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) (provide 'init-const)

View File

@@ -12,6 +12,8 @@
(dirvish-override-dired-mode) (dirvish-override-dired-mode)
:config :config
(if *is-windows* (require 'fix-dirvish-preview))
(if *is-mac* (if *is-mac*
(setq dirvish-hide-details t) (setq dirvish-hide-details t)
(setq dirvish-hide-details '(dirvish-side))) (setq dirvish-hide-details '(dirvish-side)))
@@ -68,41 +70,6 @@
"-l --almost-all --human-readable --group-directories-first --no-group") "-l --almost-all --human-readable --group-directories-first --no-group")
(put 'dired-find-alternate-file 'disabled nil) (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) (provide 'init-dired)
;;; init-dired.el ends here ;;; init-dired.el ends here

View File

@@ -71,43 +71,6 @@
(require 'emms-playing-time) (require 'emms-playing-time)
(emms-playing-time-mode 1) (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中的)快捷键 ;; 添加(playlist中的)快捷键
(define-key emms-playlist-mode-map (kbd "SPC") 'emms-pause) (define-key emms-playlist-mode-map (kbd "SPC") 'emms-pause)
(define-key emms-playlist-mode-map (kbd "N") 'emms-next) (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 "R") 'emms-random)
(define-key emms-playlist-mode-map (kbd "/") 'emms-playlist-limit) (define-key emms-playlist-mode-map (kbd "/") 'emms-playlist-limit)
;; 启用标记功能
(require 'emms-mark)
;; 启用播放列表排序 ;; 启用播放列表排序
(require 'emms-playlist-sort) (require 'emms-playlist-sort)
(define-key emms-playlist-mode-map (kbd "S s") 'emms-playlist-sort-map) (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) ;; (add-hook 'after-init-hook 'emms-history-load)

View File

@@ -102,21 +102,6 @@
(desktop-environment-screenshot-partial-command (desktop-environment-screenshot-partial-command
"import ~/Pictures/screenshot-$(date +%Y%m%d-%H%M%S).png")) "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 (add-hook 'exwm-init-hook
(lambda () (lambda ()
(unless (zerop (shell-command "pgrep -x fcitx5")) (unless (zerop (shell-command "pgrep -x fcitx5"))

View File

@@ -105,7 +105,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(switch-to-buffer "*EMMS Playlist*")) (switch-to-buffer "*EMMS Playlist*"))
(defun my/dired-next-line() (defun my/dired-next-line()
"move to forward line in dired buffer" "Move to forward line in dired buffer"
(interactive) (interactive)
(forward-line 1) (forward-line 1)
(dired-move-to-filename)) (dired-move-to-filename))

View File

@@ -30,7 +30,8 @@
"b" 'indent-bars-mode "b" 'indent-bars-mode
"t" 'consult-theme "t" 'consult-theme
"c" 'my-color-picker "c" 'my-color-picker
"f" 'describe-face) "f" 'describe-face
"R" 'rainbow-delimiters-mode)
;; f for find and consult command ;; f for find and consult command
(general-def (general-def
@@ -144,7 +145,6 @@
(general-def org-mode-map (general-def org-mode-map
"C-<tab>" 'org-cycle-parent-subtree "C-<tab>" 'org-cycle-parent-subtree
"C-c i" 'consult-outline "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 o l" 'org-toggle-link-display
"C-c C-k" 'kmacro-call-macro "C-c C-k" 'kmacro-call-macro
"M-{" 'org-previous-visible-heading "M-{" 'org-previous-visible-heading

View File

@@ -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

View File

@@ -10,7 +10,6 @@
(add-hook 'org-mode-hook (add-hook 'org-mode-hook
(lambda () (lambda ()
(require 'org-tempo) (require 'org-tempo)
(require 'init-org-refile)
(org-indent-mode) (org-indent-mode)
(visual-line-mode) (visual-line-mode)
(setq-local electric-pair-inhibit-predicate (setq-local electric-pair-inhibit-predicate
@@ -43,7 +42,7 @@
;; 设置todo关键字 ;; 设置todo关键字
(setq org-todo-keywords (setq org-todo-keywords
(quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)") (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相关 ;; agenda相关
(with-eval-after-load 'recentf (with-eval-after-load 'recentf
@@ -84,15 +83,6 @@
'org-babel-load-languages 'org-babel-load-languages
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 ;; org-download
(use-package org-download (use-package org-download
:config :config
@@ -218,7 +208,7 @@
:config :config
(org-super-agenda-mode)) (org-super-agenda-mode))
;; 自定义已完成任务视图 ;; 自定义agenda视图
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
'(("pa" "Priority >= A" '(("pa" "Priority >= A"
((tags-todo "+PRIORITY=\"A\""))) ((tags-todo "+PRIORITY=\"A\"")))

View File

@@ -16,45 +16,7 @@
:config :config
(gcmh-mode 1)) (gcmh-mode 1))
(use-package emacs ;; restart-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)))
(use-package restart-emacs) (use-package restart-emacs)
;; 安装multiple-cursors ;; 安装multiple-cursors
@@ -99,6 +61,7 @@
(default-directory "~/")) (default-directory "~/"))
(consult-fd))) (consult-fd)))
;; everything
(when *is-windows* (when *is-windows*
(setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk)) (setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk))
(setq consult-ripgrep-args (encode-coding-string (setq consult-ripgrep-args (encode-coding-string
@@ -106,18 +69,9 @@
'gbk)) 'gbk))
(add-to-list 'process-coding-system-alist '("es" gbk . gbk))) (add-to-list 'process-coding-system-alist '("es" gbk . gbk)))
;; mdfind
(when *is-mac* (when *is-mac*
(setopt consult-locate-args "mdfind -name")) (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))
(use-package consult-notes (use-package consult-notes
:config :config
@@ -182,11 +136,10 @@ targets."
(advice-add #'embark-completing-read-prompter (advice-add #'embark-completing-read-prompter
:around #'embark-hide-which-key-indicator)))) :around #'embark-hide-which-key-indicator))))
;; 安装embark-consult和wgrep ;; embark-consult
(use-package embark-consult) (use-package embark-consult
(use-package wgrep) :config
(with-eval-after-load
(with-eval-after-load
'consult 'consult
'(with-eval-after-load '(with-eval-after-load
'embark 'embark
@@ -194,7 +147,10 @@ targets."
(require 'embark-consult) (require 'embark-consult)
(add-hook (add-hook
'embark-collect-mode-hook 'embark-collect-mode-hook
#'consult-preview-at-point-mode)))) #'consult-preview-at-point-mode)))))
;; wgrep
(use-package wgrep)
;; 启用savehist保存命令顺序 ;; 启用savehist保存命令顺序
(use-package savehist (use-package savehist
@@ -218,7 +174,7 @@ targets."
(use-package undo-fu-session (use-package undo-fu-session
:init (undo-fu-session-global-mode)) :init (undo-fu-session-global-mode))
;; vundop,撤回树 ;; vundo撤回树
(use-package vundo (use-package vundo
:init (setq undo-limit 800000 :init (setq undo-limit 800000
undo-strong-limit 1200000 undo-strong-limit 1200000
@@ -231,7 +187,8 @@ targets."
(use-package projectile (use-package projectile
:init (projectile-mode) :init (projectile-mode)
:bind (:map projectile-mode-map :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)) :config (setq projectile-enable-caching t))
(use-package ibuffer-projectile (use-package ibuffer-projectile
@@ -283,6 +240,9 @@ targets."
(unless *is-windows* (unless *is-windows*
(use-package vterm)) (use-package vterm))
;; eat
(use-package eat)
;; general ;; general
(use-package general) (use-package general)

View File

@@ -27,6 +27,8 @@
(with-eval-after-load 'geiser (with-eval-after-load 'geiser
(setq geiser-default-implementation 'guile))) (setq geiser-default-implementation 'guile)))
(use-package geiser-guile)
;; markdown ;; markdown
(use-package markdown-mode (use-package markdown-mode
:mode ("README\\.md\\'" . gfm-mode) :mode ("README\\.md\\'" . gfm-mode)
@@ -34,7 +36,6 @@
:bind (:map markdown-mode-map :bind (:map markdown-mode-map
("C-c C-e" . markdown-do))) ("C-c C-e" . markdown-do)))
(use-package geiser-guile)
(provide 'init-prog) (provide 'init-prog)

View File

@@ -90,23 +90,6 @@
(if (boundp 'use-short-answers) (if (boundp 'use-short-answers)
(setq use-short-answers t) (setq use-short-answers t)
(fset 'yes-or-no-p 'y-or-n-p)) (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 ; Dont 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) (provide 'init-startup)

View File

@@ -4,11 +4,6 @@
;;; Code: ;;; Code:
;; 修改mac键位
(when *is-mac*
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'none))
(defun open-init-file() (defun open-init-file()
"Open user's init.el file in ~/.emacs.d ." "Open user's init.el file in ~/.emacs.d ."
(interactive) (interactive)
@@ -32,20 +27,13 @@
(general-def "C-c <f12>" 'scratch-buffer) (general-def "C-c <f12>" 'scratch-buffer)
(general-def "C-c <delete>" 'scratch-buffer)) (general-def "C-c <delete>" 'scratch-buffer))
;; markdown
(general-def markdown-mode-map
"M-p" nil
"M-n" nil)
;; org-mode ;; org-mode
(general-def org-mode-map (general-def org-mode-map
"C-<tab>" 'org-cycle-current-subtree "C-<tab>" 'org-cycle-parent-subtree
"C-c o l" 'org-toggle-link-display) "C-c o l" 'org-toggle-link-display
"C-c C-k" 'kmacro-call-macro
;; vterm "M-{" 'org-previous-visible-heading
(general-def vterm-mode-map "M-}" 'org-next-visible-heading)
"M-]" nil
"C-q" 'vterm-send-next-key)
;; global map with C-c prefix ;; global map with C-c prefix
(general-def (general-def