commit 8a833884ebea92607671423dad6e9a7f633243bf parent 1d747649f97db00062217cfcbdf365d0a44d39c1 Author: andsy10 <andsy1016@gmail.com> Date: Mon, 7 Sep 2026 06:40:42 +0800 Optimize dirvish and dired-rsync config Diffstat:
| M | lisp/init-dired.el | | | 32 | +++++++++++++++++--------------- |
| M | lisp/init-package.el | | | 5 | +++++ |
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/lisp/init-dired.el b/lisp/init-dired.el @@ -32,26 +32,21 @@ (dirvish-override-dired-mode) :config (defun my-dirvish-layout-toggle () - "Toggle layout using first recipe in `dirvish-layout-recipes' instead of -fallback." + "Toggle layout using the first recipe in `dirvish-layout-recipes' instead of +the hardcoded fallback recipe." (interactive) - (let ((dv (dirvish-curr))) - (unless dv (user-error "Not a dirvish buffer")) + (let ((dv (or (dirvish-curr) (user-error "Not a dirvish buffer")))) (unless (dv-curr-layout dv) (setf (dv-ff-layout dv) (car dirvish-layout-recipes))) (dirvish-layout-toggle))) - (require 'vc) - - (if (or *is-mac* *is-android*) - (setq dirvish-hide-details t) - (setq dirvish-hide-details '(dirvish-side))) - (if *is-android* (setq dirvish-default-layout nil - dirvish-layout-recipes '((1 0.6))) + dirvish-layout-recipes '((0 0 0.6)) + dirvish-hide-details t) (setq dirvish-default-layout nil - dirvish-layout-recipes '((1 0.15 0.45)))) + dirvish-layout-recipes '((1 0.15 0.45)) + dirvish-hide-details '(dirvish dirvish-side))) (setq dirvish-use-mode-line nil dirvish-mode-line-format '(:left (sort omit symlink) :right (free-space index)) @@ -132,9 +127,16 @@ fallback." (use-package dired-rsync :config (setq dired-rsync-options "-az -e ssh") - (setq-default mode-line-format - (append mode-line-format - '((:eval (propertize dired-rsync-modeline-status 'face 'dired-async-mode-message)))))) + + (defconst my-dired-rsync--mode-line-construct + '(:eval (propertize dired-rsync-modeline-status + 'face 'dired-async-mode-message))) + + (unless (member my-dired-rsync--mode-line-construct + (default-value 'mode-line-format)) + (setq-default mode-line-format + (cons my-dired-rsync--mode-line-construct + (default-value 'mode-line-format))))) ;; mount disk (when *is-linux* diff --git a/lisp/init-package.el b/lisp/init-package.el @@ -175,6 +175,11 @@ Like normal Emacs `C-k'. Kill to end of line and put content in kill-ring." (diff-hl-mode . global-diff-hl-show-hunk-mouse-mode) (diff-hl-mode . diff-hl-flydiff-mode)) +;; vc +(use-package vc + :straight nil + :autoload vc-create-repo) + ;; project (use-package project :straight nil