doomemacs/modules/emacs/dired
Henrik Lissner a6c3c6842a
refactor(dired): use dirvish-preview-environment
- Remove +dired--suppress-hooks-in-previews-a, because Dirvish already
  does this.
- Exploit dirvish-preview-environment instead of hardcoding the
  enable-local-variables let-binding for the child process. Its defaults
  are more reasonable.
2024-08-21 02:11:55 -04:00
..
autoload.el emacs/dired: don't enable dired-git-info in ranger 2019-11-24 16:50:47 -05:00
config.el refactor(dired): use dirvish-preview-environment 2024-08-21 02:11:55 -04:00
doctor.el refactor!(dired): use dirvish, drop +ranger 2024-08-18 03:57:12 -04:00
packages.el refactor!(dired): use dirvish, drop +ranger 2024-08-18 03:57:12 -04:00
README.org refactor!(dired): use dirvish, drop +ranger 2024-08-18 03:57:12 -04:00

:emacs dired

Description   unfold

This module provides reasonable defaults and augmentations for Dired (the built-in file manager for Emacs), powered by Dirvish.

Module flags

+dirvish
Enables full dirvish integration, providing a more modern interface for Dired that is reminiscent of Ranger. Without this flag, Dirvish is still installed and used, but only for its minor augmentations to Dired.
+icons
Enables the display of fancy icons depending on file types in dired buffers, as well as arrows for expanded/collapsed directories.

TODO Hacks

󱌣 This module's hacks haven't been documented yet. Document them?

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module has no requirements except on BSDs like MacOS or FreeBSD, where GNU ls (aka gls) is required.

Optionally, install these dependencies to improve the preview experience:

  • imagemagick for image previews
  • poppler (or doom-module::tools pdf-tools) for pdf previews,
  • ffmpegthumbnailer for video previews,
  • mediainfo for audio/video metadata generation,
  • tar and unzip for archive files previews.

macOS

$ brew install coreutils fd poppler ffmpegthumbnailer mediainfo imagemagick

Debian-based

$ apt install fd-find poppler-utils ffmpegthumbnailer mediainfo imagemagick tar unzip

Arch-based

$ pacman -S fd poppler ffmpegthumbnailer mediainfo imagemagick tar unzip

FreeBSD

$ pkg install gnuls fd-find poppler ffmpegthumbnailer ImageMagick7 gtar

Windows (not tested)

Via Scoop:

$ scoop install coreutils fd poppler imagemagick unzip

Usage

Global bindings

You can access Dired/Dirvish by opening a directory entry in commands like find-file (SPC f f). Or you can create a Dired buffer directly with these keybindings.

Keybind Description
SPC f d Find directory with dired
SPC o - Jump to current directory in dired

These commands are available but not bound to any keys.

Command Description
M-x dirvish Open dired with preview
M-x dirvish-dwim Dirvish with smart layout
M-x dirvish-fd Search files in dired using fd
M-x dirvish-side Open project sidebar

Dired bindings

Basics

Keybind Description
n Move down a line
p Move up a line
e or RET Visit the file or directory on this line
( Toggle visibility of detailed information
q Exit dired buffer
^ Go Up a directory
m Mark a file
u Unmark a file
D Delete a file
+ Create a directory

This is only a very small sample of dired keybindings, just for you to get a sense of Dired. Other basic keybindings can be found on the official Dired reference card. If you have enabled (evil +everywhere), you would get a different set of bindings (j/k for move down/up a line), consult evil-collection for the actual bindings.

Extras

You don't have to memorize all of Dired bindings because this module provided a lot of easy-to-read menus such as dirvish-mark-menu (powered by transient.el) for you to find the suitable command in a specific context. All of these (sub-)menus are included in dirvish-dispatch (?), the main help menu. Some extremely useful ones are bound to a separate keys as well.

Keybind Description
? Ask for help
a Quick access frequently used directories
f Get file information under the cursor
y For copying marked files or their paths
s For creating symlinks
S Sort buffer with different criteria
M-m Commands relate to marking and actions
M-s Setup user interface for dirvish
M-e "Emerge" important files at the top

Other bindings in this module:

TAB Expand or contract directory under the cursor
M-f Jump to next dired history entry
M-b Jump to previous dired history entry
M-n Narrow the buffer with user input
M-t Toggle fullscreen (preview)
C-c C-e Rename entries with doom-package:wdired

Configuration

Quick access entries

Use the following syntax to configure the entries displayed in dirvish-quick-access command.

;;; add to $DOOMDIR/config.el
(after! dirvish
  (setq! dirvish-quick-access-entries
         `(("h" "~/"                          "Home")
           ("e" ,user-emacs-directory         "Emacs user directory")
           ("c" "~/Code/"                     "Code")
           ("d" "~/Downloads/"                "Downloads")
           ("m" "/mnt/"                       "Mounted drives")
           ("t" "~/.local/share/Trash/files/" "Trash"))))

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

How to kill all session buffers on quit?

Set dirvish-reuse-session to nil.

TODO Appendix

󱌣 This module has no appendix yet. Write one?