Skip to content

Commit 720ddad

Browse files
committed
feat!(dired): use dirvish by default
BREAKING CHANGE: Deprecate `+ranger` flag, use package dirvish by default and rewrite the module based on it. Doing so we can remove these packages and their associated hacks: `all-the-icons-dired`, `dired-rsync`, `fd-dired`, `dired-git-info`, `ranger`. See file log below for details. purcell/diredfl@f9140b2c4215 -> purcell/diredfl@62b559e1d6b6 alexluigit/dirvish@73dcaa404da9 -> alexluigit/dirvish@11a3bec247b9 * modules/ui/vc-gutter/config.el(dired-mode-hook, diff-hl-dired-mode): when dired module is enabled, use `vc-state` from dirvish to render the vc gutter instead of diff-hl-dired-mode, doing so we get better performance and integration with the dired module. * modules/emacs/dired/autoload.el: delete this file since the commands in it are no longer used. * modules/emacs/dired/doctor.el: add deprecate warning for `+ranger` flag * modules/emacs/dired/README.org: rewrite based on the new features * modules/emacs/dired/config.el: - (dirvish-mode-line-format, dired-hide-details-hide-symlink-targets): set `dired-hide-details-hide-symlink-targets` to t, show symlink target on mode-line instead - (dired-listing-switches, +dired-disable-gnu-ls-flags-maybe-h): dirvish has inbuilt gnuls check, so the setup for `dired-listing-switches` can be simplified as such and the `+dired-disable-gnu-ls-flags-maybe-h` can be safely removed. - (+dired/quit-all): dirvish has a fine-tuned machinery for closing dired buffers, so replace this command with `dirvish-quit`. One can set `dirvish-reuse-session` to nil to get similar behavior to `+dired/quit-all`. - (dired-rsync): replace `dired-rsync` with `dirvish-rsync` - (+ranger): deprecate this flag. - (dirvish-attributes, all-the-icons-dired): remove package `all-the-icons-dired`, use `all-the-icons` attribute in dirvish to implement the `+icons` flag. - (fd-dired): use the better alternative dirvish-fd to replace this command/package. - (dirvish-attributes, dired-git-info-mode): use `git-msg` attribute from dirvish to replace dired-git-info-mode. - (dirvish-attributes): add `collapse` attribute for `+dirvish` flag - (dirvish-attributes): add `subtree-state` attribute for `+icons` flag - (dirvish-mode-map): introduce a few new keybindings such as `dirvish-subtree-toggle` - (dirvish-attributes, dirvish-use-header-line, dirvish-mode-line-format, dirvish-hide-cursor, dirvish-hide-details): support classic dired UI when +dirvish is not enabled. Fix: doomemacs#6562 Replace: doomemacs#6568 Ref: https://github.com/alexluigit/dirvish/blob/a877ba816f907daea2d86bd10754bec6484e753a/dirvish-extras.el#L172-L190 Ref: alexluigit/dirvish#34 Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#find-dired--fd-dired Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#all-the-icons-dired Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#dired-git-info--diff-hl--dired-k Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#dired-rsync
1 parent 4d24a3f commit 720ddad

File tree

6 files changed

+212
-231
lines changed

6 files changed

+212
-231
lines changed

modules/emacs/dired/README.org

+136-33
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,29 @@
44
#+since: 2.0.0
55

66
* Description :unfold:
7-
This module provides reasonable defaults and augmentations for dired.
7+
This module provides reasonable defaults and augmentations for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired]], the
8+
inbuilt file manager for Emacs. The extra features are mostly introduced by the
9+
Dired enhancement package [[https://github.com/alexluigit/dirvish][Dirvish]].
810

911
** Maintainers
10-
/This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]]
12+
- [[doom-user:][@alexluigit]]
13+
14+
[[doom-contrib-maintainer:][Become a maintainer?]]
1115

1216
** Module flags
1317
- +icons ::
1418
Enables the display of fancy icons depending on file types in dired buffers.
15-
- +ranger ::
16-
Enables dired to be more like [[https://github.com/ranger/ranger][ranger]].
19+
- +dirvish ::
20+
Apply some stylistic defaults to the Dired buffer.
21+
+ Show file size at right fringe
22+
+ Collapse directories with only one entry in it automatically.
23+
+ Use prettified header line and mode line
24+
+ Hide file details information by default
25+
+ Enable line highlighting, hide the cursor
1726

1827
** Packages
19-
- [[doom-package:][all-the-icons-dired]] if [[doom-module:][+icons]]
20-
- [[doom-package:][diff-hl]]
28+
- [[doom-package:][dirvish]]
2129
- [[doom-package:][diredfl]]
22-
- [[doom-package:][dired-rsync]]
23-
- [[doom-package:][fd-dired]]
24-
- [[doom-package:][ranger]] if [[doom-module:][+ranger]]
2530

2631
** TODO Hacks
2732
#+begin_quote
@@ -38,35 +43,133 @@ This module provides reasonable defaults and augmentations for dired.
3843
This module has no requirements *except on BSDs* like MacOS or FreeBSD, where
3944
=GNU ls= (aka ~gls~) is required.
4045

41-
* TODO Usage
42-
#+begin_quote
43-
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
44-
#+end_quote
45-
46-
| Keybind | Description |
47-
|---------+----------------------------|
48-
| [[kbd:][SPC f d]] | Find directory with dired |
49-
| [[kbd:][q]] | Exit dired buffer |
50-
| [[kbd:][C-c C-r]] | Run [[doom-package:][dired-rsync]] |
51-
| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] |
52-
53-
Other keybindings can be found on the official [[https://www.gnu.org/software/emacs/refcards/pdf/dired-ref.pdf][Dired reference card]].
54-
55-
** Ranger
56-
If [[doom-module:][+ranger]] is enabled often a buffer will be opened in minimal ranger mode
57-
(~deer-mode~). In this case [[kbd:][z P]] can be used to toggle between full ranger and
58-
~deer-mode~.
59-
60-
* TODO Configuration
61-
#+begin_quote
62-
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]
63-
#+end_quote
46+
Optionally, install these dependencies to improve the preview experience:
47+
48+
+ =imagemagick= for image preview
49+
+ =poppler= | =pdf-tools= for pdf preview
50+
+ =ffmpegthumbnailer= for video preview
51+
+ =mediainfo= for audio/video metadata generation
52+
+ =tar= and =unzip= for archive files preview
53+
54+
** macOS
55+
#+begin_src bash
56+
brew install coreutils fd poppler ffmpegthumbnailer mediainfo imagemagick
57+
#+end_src
58+
59+
** Debian-based
60+
#+begin_src bash
61+
apt install fd-find poppler-utils ffmpegthumbnailer mediainfo imagemagick tar unzip
62+
#+end_src
63+
64+
** Arch-based
65+
#+begin_src bash
66+
pacman -S fd poppler ffmpegthumbnailer mediainfo imagemagick tar unzip
67+
#+end_src
68+
69+
** FreeBSD
70+
#+begin_src bash
71+
pkg install gnuls fd-find poppler ffmpegthumbnailer ImageMagick7 gtar
72+
#+end_src
73+
74+
** Windows (not tested, may not work)
75+
#+begin_src bash
76+
# install via Scoop: https://scoop.sh/
77+
scoop install coreutils fd poppler imagemagick unzip
78+
#+end_src
79+
80+
* Usage
81+
** Global bindings
82+
You can access Dired/Dirvish by opening a directory entry in commands like
83+
~find-file (SPC f f)~. Or you can create a Dired buffer directly with these
84+
keybindings.
85+
86+
| Keybind | Description |
87+
|------------------------------+------------------------------------|
88+
| [[kbd:][SPC f d]] | Find directory with dired |
89+
| [[kbd:][SPC o -]] | Jump to current directory in dired |
90+
91+
These commands are available but not bound to any keys.
92+
93+
| Command | Description |
94+
|------------------+--------------------------------|
95+
| [[kbd:][M-x dirvish]] | Open dired with preview |
96+
| [[kbd:][M-x dirvish-dwim]] | Dirvish with smart layout |
97+
| [[kbd:][M-x dirvish-fd]] | Search files in dired using fd |
98+
| [[kbd:][M-x dirvish-side]] | Open project sidebar |
99+
100+
** Dired bindings
101+
*** Basics
102+
| Keybind | Description |
103+
|----------+-------------------------------------------|
104+
| [[kbd:][n]] | Move down a line |
105+
| [[kbd:][p]] | Move up a line |
106+
| [[kbd:][e]] or [[kbd][RET]] | Visit the file or directory on this line |
107+
| [[kbd:][(]] | Toggle visibility of detailed information |
108+
| [[kbd:][q]] | Exit dired buffer |
109+
| [[kbd:][^]] | Go Up a directory |
110+
| [[kbd:][m]] | Mark a file |
111+
| [[kbd:][u]] | Unmark a file |
112+
| [[kbd:][D]] | Delete a file |
113+
| [[kbd:][+]] | Create a directory |
114+
| ... | ... |
115+
116+
This is only a very small sample of dired keybindings, just for you to get a
117+
sense of Dired. Other basic keybindings can be found on the official [[https://www.gnu.org/software/emacs/refcards/pdf/dired-ref.pdf][Dired
118+
reference card]]. If you have enabled ~(evil +everywhere)~, you would get a
119+
different set of bindings ([[kbd][j/k]] for move down/up a line), consult =evil-collection=
120+
for the actual bindings.
121+
122+
*** Extras
123+
You don't have to memorize all of Dired bindings because this module provided a
124+
lot of easy-to-read menus such as ~dirvish-mark-menu~ (powered by =transient.el=)
125+
for you to find the suitable command in a specific context. All of these
126+
(sub-)menus are included in ~dirvish-dispatch (?)~, the main help menu. Some
127+
extremely useful ones are bound to a separate keys as well.
128+
129+
| Keybind | Description |
130+
|---------+-----------------------------------------------|
131+
| [[kbd:][?]] | Ask for help |
132+
| [[kbd:][a]] | Quick access frequently used directories |
133+
| [[kbd:][f]] | Get file information under the cursor |
134+
| [[kbd:][y]] | Paste/link/move marked files here |
135+
| [[kbd:][s]] | Sort buffer with different criteria |
136+
| [[kbd:][M-m]] | Commands relate to marking and actions |
137+
| [[kbd:][M-s]] | Setup user interface for dirvish |
138+
| [[kbd:][M-e]] | "Emerge" important files at the top |
139+
140+
Other bindings in this module:
141+
142+
| [[kbd:][TAB]] | Expand or contract directory under the cursor |
143+
| [[kbd:][M-f]] | Jump to next dired history entry |
144+
| [[kbd:][M-b]] | Jump to previous dired history entry |
145+
| [[kbd:][M-n]] | Narrow the buffer with user input |
146+
| [[kbd:][M-t]] | Toggle fullscreen (preview) |
147+
| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] |
148+
149+
* Configuration
150+
** Quick access entries
151+
152+
Use the following syntax to configure the entries displayed in
153+
~dirvish-quick-access~ command.
154+
155+
#+begin_src emacs-lisp
156+
;; in $DOOMDIR/config.el
157+
(setq! dirvish-quick-access-entries
158+
`(("h" "~/" "Home")
159+
("e" ,user-emacs-directory "Emacs user directory")
160+
("c" "~/Code/" "Code")
161+
("d" "~/Downloads/" "Downloads")
162+
("m" "/mnt/" "Mounted drives")
163+
("t" "~/.local/share/Trash/files/" "Trash")))
164+
#+end_src
64165

65166
* Troubleshooting
66167
/There are no known problems with this module./ [[doom-report:][Report one?]]
67168

68169
* Frequently asked questions
69-
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
170+
** How to kill all session buffers on quit?
171+
172+
Set ~dirvish-reuse-session~ to nil.
70173

71174
* TODO Appendix
72175
#+begin_quote

modules/emacs/dired/autoload.el

-15
This file was deleted.

0 commit comments

Comments
 (0)