Skip to content

Commit

Permalink
feat(dired): restructure the module based on dirvish
Browse files Browse the repository at this point in the history
- Deprecate `+ranger` flag, use dirvish by default

  See: alexluigit/dirvish#34

- Bump the package version for diredfl and dirvish
- Reimplement `+icons`, deprecate package all-the-icons-dired

  all-the-icons-dired is very slow on large directories,
  while dirvish render icons lazily.

- Use `vc-state` from dirvish, remove diff-hl-dired-mode

  1. diff-hl-dired-mode doesn't index the entries in subtrees.
  2. It freezes Emacs on big repos, while dirvish does this in external process
  and update the UI asynchronously.

- Use `git-msg` from dirvish, deprecate package dired-git-info

  Same reasons as in diff-hl-dired-mode.

- Use utilities in dirvish-yank.el, deprecate package dired-rsync

  `dirvish-yank` has inbuilt support for rsync.

- Use dirvish-fd, deprecate package fd-dired

  `dirvish-fd` is way powerful.

- Remove the gnuls check on remote hosts

  dirvish checks gnu ls availability for each remote host.

- Set `dired-hide-details-hide-symlink-targets` to t (default)

  We have symlink target showing on the modeline

- Add a few sensible keybindings globally

- Add `+bindings` flag for additional keybindings
  • Loading branch information
alexluigit committed Sep 8, 2022
1 parent 0172b18 commit 6c4d4db
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 216 deletions.
6 changes: 6 additions & 0 deletions modules/config/default/+emacs-bindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
:desc "Find file from here" "F" #'+default/find-file-under-here
:desc "Locate file" "l" #'locate
:desc "Rename/move this file" "m" #'doom/move-this-file
(:when (modulep! :emacs dired)
:desc "Find file names in dired" "n" #'dirvish-fd)
:desc "Find file in private config" "p" #'doom/find-file-in-private-config
:desc "Browse private config" "P" #'doom/open-private-config
:desc "Recent files" "r" #'recentf-open-files
Expand Down Expand Up @@ -236,6 +238,10 @@
:desc "REPL" "r" #'+eval/open-repl-other-window
:desc "REPL (same window)" "R" #'+eval/open-repl-same-window
:desc "Dired" "-" #'dired-jump
(:when (modulep! :emacs dired)
;; REVIEW: shall we bind dirvish-side here?
;; :desc "Project sidebar" "p" #'dirvish-side
:desc "Dired w/ preview" "v" #'dirvish)
(:when (modulep! :ui neotree)
:desc "Project sidebar" "p" #'+neotree/open
:desc "Find file in project sidebar" "P" #'+neotree/find-this-file)
Expand Down
6 changes: 6 additions & 0 deletions modules/config/default/+evil-bindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@
:desc "Find file" "f" #'find-file
:desc "Find file from here" "F" #'+default/find-file-under-here
:desc "Locate file" "l" #'locate
(:when (modulep! :emacs dired)
:desc "Find file names in dired" "n" #'dirvish-fd)
:desc "Find file in private config" "p" #'doom/find-file-in-private-config
:desc "Browse private config" "P" #'doom/open-private-config
:desc "Recent files" "r" #'recentf-open-files
Expand Down Expand Up @@ -605,6 +607,10 @@
:desc "REPL" "r" #'+eval/open-repl-other-window
:desc "REPL (same window)" "R" #'+eval/open-repl-same-window
:desc "Dired" "-" #'dired-jump
(:when (modulep! :emacs dired)
;; REVIEW: resolve conflict between dirvish-side and neotree/treemacs
;; :desc "Project sidebar" "p" #'dirvish-side
:desc "Dired w/ preview" "v" #'dirvish)
(:when (modulep! :ui neotree)
:desc "Project sidebar" "p" #'+neotree/open
:desc "Find file in project sidebar" "P" #'+neotree/find-this-file)
Expand Down
91 changes: 72 additions & 19 deletions modules/emacs/dired/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@
This module provides reasonable defaults and augmentations for dired.

** Maintainers
/This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]]
- [[doom-user:][@alexluigit]]

[[doom-contrib-maintainer:][Become a maintainer?]]

** Module flags
- +icons ::
Enables the display of fancy icons depending on file types in dired buffers.
- +ranger ::
Enables dired to be more like [[https://github.com/ranger/ranger][ranger]].
- +bindings ::
Enables some sensible keybindings in dired buffers, see below.

** Packages
- [[doom-package:][all-the-icons-dired]] if [[doom-module:][+icons]]
- [[doom-package:][diff-hl]]
- [[doom-package:][dirvish]]
- [[doom-package:][diredfl]]
- [[doom-package:][dired-rsync]]
- [[doom-package:][fd-dired]]
- [[doom-package:][ranger]] if [[doom-module:][+ranger]]

** TODO Hacks
#+begin_quote
Expand All @@ -38,25 +36,80 @@ This module provides reasonable defaults and augmentations for dired.
This module has no requirements *except on BSDs* like MacOS or FreeBSD, where
=GNU ls= (aka ~gls~) is required.

Optionally, you can install these dependencies to improve the preview
experience:

+ =fd= as a faster alternative to =find=
+ =imagemagick= for image preview
+ =poppler= | =pdf-tools= for pdf preview
+ =ffmpegthumbnailer= for video preview
+ =mediainfo= for audio/video metadata generation
+ =tar= and =unzip= for archive files preview

** macOS
#+begin_src bash
brew install coreutils fd poppler ffmpegthumbnailer mediainfo imagemagick
#+end_src

** Debian-based
#+begin_src bash
apt install fd-find poppler-utils ffmpegthumbnailer mediainfo imagemagick tar unzip
#+end_src

** Arch-based
#+begin_src bash
pacman -S fd poppler ffmpegthumbnailer mediainfo imagemagick tar unzip
#+end_src

** FreeBSD
#+begin_src bash
pkg install gnuls fd-find poppler ffmpegthumbnailer ImageMagick7 gtar
#+end_src

** Windows (not tested, may not work)
#+begin_src bash
# install via Scoop: https://scoop.sh/
scoop install coreutils fd poppler imagemagick unzip
#+end_src

* TODO Usage
#+begin_quote
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
#+end_quote

| Keybind | Description |
|---------+----------------------------|
| [[kbd:][SPC f d]] | Find directory with dired |
| [[kbd:][q]] | Exit dired buffer |
| [[kbd:][C-c C-r]] | Run [[doom-package:][dired-rsync]] |
| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] |
** Global bindings
| Keybind | Description |
|---------+---------------------------|
| [[kbd:][SPC f d]] | Find directory with dired |
| [[kbd:][SPC f n]] | Find file names in dired |
| [[kbd:][SPC o v]] | Open dired with preview |

** Dired/Dirvish bindings
| Keybind | Description |
|---------+-----------------------------|
| [[kbd:][q]] | Exit dired buffer |
| [[kbd:][?]] | Ask for help |
| [[kbd:][M-t]] | Toggle fullscreen (preview) |
| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] |

If [[doom-module:][+bindings]] is enabled, these bindings are available as well.

| Keybind | Description |
|---------+-----------------------------------------------|
| [[kbd:][a]] | Quick access frequently used directories |
| [[kbd:][f]] | Get file information under the cursor |
| [[kbd:][y]] | Paste/link/move marked files here |
| [[kbd:][s]] | Sort buffer with different criteria |
| [[kbd:][TAB]] | Expand or contract directory under the cursor |
| [[kbd:][M-f]] | Jump to next dired history entry |
| [[kbd:][M-b]] | Jump to previous dired history entry |
| [[kbd:][M-m]] | Mark files in different ways |
| [[kbd:][M-s]] | Setup user interface for dirvish |
| [[kbd:][M-n]] | Narrow the buffer with user input |
| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] |

Other keybindings can be found on the official [[https://www.gnu.org/software/emacs/refcards/pdf/dired-ref.pdf][Dired reference card]].

** Ranger
If [[doom-module:][+ranger]] is enabled often a buffer will be opened in minimal ranger mode
(~deer-mode~). In this case [[kbd:][z P]] can be used to toggle between full ranger and
~deer-mode~.

* TODO Configuration
#+begin_quote
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]
Expand Down
15 changes: 0 additions & 15 deletions modules/emacs/dired/autoload.el

This file was deleted.

Loading

0 comments on commit 6c4d4db

Please sign in to comment.