Files
.emacs.d/lisp/init-dired.el
andsy10 6848afd4da feat: Add SLY Common Lisp support and refine EXWM configuration
- Add SLY package with custom keybindings and ibuffer groups Replace
- removed power commands with consolidated `my-desktop-init` Add
- Emacs key simulation for EXWM windows Enable mouse drag-and-drop
- for Dired Disable display-time on Linux/Android Rebind window
- resize to C-M-arrow keys
2026-05-27 20:27:27 +08:00

119 lines
3.5 KiB
EmacsLisp

;;; init-dired.el --- dired & dirvish -*-lexical-binding: t -*-
;;; Commentary:
;;; Code:
(use-package dired
:straight nil
:config
(when *is-mac*
(setq insert-directory-program "gls"
dired-use-ls-dired t))
(setq dired-dwim-target t
dired-listing-switches
"-l --almost-all --human-readable --group-directories-first --no-group"
dired-recursive-deletes 'always
dired-recursive-copies 'always
dired-mouse-drag-files t
mouse-drag-and-drop-region-cross-program t)
(put 'dired-find-alternate-file 'disabled nil))
;; dirvish
(use-package dirvish
:hook
(dired-mode-hook . denote-dired-mode)
:init
(dirvish-override-dired-mode)
:config
(require 'vc)
(if *is-windows* (require 'fix-dirvish-preview))
(if (or *is-mac* *is-android*)
(setq dirvish-hide-details t)
(setq dirvish-hide-details '(dirvish-side)))
(setq dirvish-use-mode-line t)
(unless *is-windows*
(setq dirvish-attributes '(file-time file-size)))
(if *is-android*
(setq dirvish-default-layout '(1 0.6))
(setq dirvish-default-layout '(1 0.15 0.45)))
(with-eval-after-load 'dirvish
(add-hook 'dired-mode-hook #'dired-hide-details-mode))
:custom
(dirvish-quick-access-entries
(cond
(*is-windows*
'(("h" "~/" "Home")
("e" "~/.emacs.d/" "Emacs config")
("p" "c:/Users/gaozh/Pictures/Screenshots/" "Pictures")
("d" "f:/下载25-2-10/" "Download")
("v" "f:/luping26-1-11/" "Videos")
("n" "h:/emacs/my-org-note/" "Notes")))
(*is-mac*
'(("h" "~/" "Home")
("e" "~/.emacs.d/" "Emacs config")
("p" "~/Pictures/" "Pictures")
("d" "~/Downloads/" "Download")
("v" "~/Movies/" "Videos")
("n" "~/org/my-org-note/" "Notes")
("g" "~/gptel/" "gptel sessions")))
(*is-linux*
'(("h" "~/" "Home")
("e" "~/.emacs.d/" "Emacs config")
("s" "~/.config/guix/" "System config")
("p" "~/Pictures/" "Pictures")
("d" "~/downloads/" "Downloads")
("v" "~/视频/" "Videos")
("n" "~/org/my-org-note/" "Notes")
("g" "~/gptel/" "gptel sessions")))
(*is-android*
'(("h" "~/" "Home")
("e" "~/.emacs.d" "Emacs")
("n" "~/storage/shared/my-org-note/" "Notes")
("g" "~/gptel/" "gptel sessions")))
(t nil))))
;; gitignore
(use-package dired-gitignore
:after
(dirvish dirvish-vc transient)
:demand t
:config
(transient-define-suffix dirvish-toggle-gitignore ()
"Toggle `dired-gitignore-mode' in current Dirvish buffer."
:description
(lambda ()
(format "Gitignore filter (%s)"
(if dired-gitignore-mode
(propertize "+" 'face 'transient-value)
(propertize "-" 'face 'transient-inactive-value))))
:transient t
(interactive)
(dired-gitignore-mode 'toggle))
(transient-append-suffix 'dirvish-vc-menu "v"
'("i" dirvish-toggle-gitignore)))
;; trashed
(use-package trashed
:commands
(trashed)
:config
(setq trashed-action-confirmer 'y-or-n-p
trashed-use-header-line t
trashed-sort-key '("Date deleted" . t)
trashed-date-format "%Y-%m-%d %H:%M:%S"))
(provide 'init-dired)
;;; init-dired.el ends here