Dirvish is a minimalistic file manager based on dired. This package tries to empower dired with a modern user interface, in the meantime, preserves the customizability of dired. Emacs users deserve a file manager that is even better than those popular ones such as ranger, vifm, lf since it is not limited to a terminal.
The name dirvish is a tribute to vim-dirvish.
Package | Description | Required |
---|---|---|
exa | For directory preview | Yes |
all-the-icons.el | Icon support | Optional |
pdftoppm | Generate pdf preface image | Optional |
imagemagick | Generate image cache | Optional |
ffmpegthumbnailer | Generate video thumbnailer | Optional |
epub-thumbnailer | Generate epub thumbnailer | Optional |
zipinfo | Preview zip files | Optional |
mediainfo | Show information for audio files | Optional |
Dirvish is available from Melpa, you can install it directly via package-install
if you have melpa in your package-archives
.
To install it manually, first clone this repository,
git clone https://github.com/alexluigit/dirvish
then add path/to/dirvish
to your load-path
.
(add-to-list 'load-path "/path/to/dirvish")
(require 'dirvish)
Alternatively, install it by using use-package and straight in tandem.
(use-package dirvish
:straight t)
After installation, just M-x
and run dirvish
.
Since dirvish-mode
is just a major-mode
derived from dired-mode
, it respects all
of your dired config (including keymapping) in principle.
As an example, here is an excerpt from my personal dired config:
(setq dired-kill-when-opening-new-dired-buffer t) ;; added in emacs 28
(setq dired-clean-confirm-killing-deleted-buffers nil)
(setq large-file-warning-threshold 50000000)
(setq dired-recursive-copies 'always)
(setq dired-recursive-deletes 'always)
(setq delete-by-moving-to-trash t)
(setq dired-dwim-target t)
(setq dired-listing-switches "-AGhlv --group-directories-first --time-style=long-iso")
When dirvish-enable-preview
is non-nil, a preview window showing the content of
selected file/directory will be displayed at right side of dirvish frame.
- Debouncing
- Native GIF support
- Image cache
Dired is superb, but from a modern file manager’s (like ranger, lf) perspective, it lacks some abilities when it comes file operation, such as:
- You can not mark files/directory across multiple dired buffers (by default)
- You can not paste/move files without specify the target directory explicitly (input in minibuffer)
Whereas with dirvish, you can:
- Marking files across multiple dirvish buffers
- Paste/move marked files/directory to current directory with one keystroke
To prevent emacs from getting freezes, dirvish uses external process to deal with heavy I/O task, such as file copy/move, directory preview, or image cache generation etc.
You don’t need all-the-icons-dired anymore since dirvish have built-in icon support. This native icon solution has several advantages over dired + all-the-icons-dired, those are:
- it handles line highlighting nicely (all-the-icons-dired doesn’t play well
with
hl-line-mode
). - it doesn’t render icon for all the files in a directory eagerly, instead it
only render icons that are displayed within the viewport. (Try visiting
/usr/bin
or any directory with over 1000 files using both dirvish or dired + all-the-icons-dired to see the difference.)
Usually dirvish
takes up the whole frame, but sometimes we prefer managing files
inside current window, just like how dired does it. To enable a single window
dirvish, you can either:
- Enable it once
(dirvish nil t)
- Enable it automatically everytime you invoke
dired-jump
(dirvish-override-dired-jump)
See dirvish wiki [TODO] for all customization options.
This package is inspired a lot by ranger.el, thanks @ralesi for bringing in ranger to emacs!
Although these 2 packages have something in common, unlike ranger.el, which tries to become an all-around emulation of ranger, dirvish is more bare-bone (roughly 1.2 kLOC), meaning it does NOT try to port all “goodness” from ranger. Instead, it only tries to:
- provides a better dired UI
- support preview for directory and common file types.
- improve some dired commands, make them more intuitive and accesible.
And here are some specific differences between dirvish and ranger.el:
- Highlight current line / Icons
Ranger uses
hl-line-mode
to highlight current line, but this minor-mode doesn’t play very well withall-the-icons-dired-mode
.- Ranger + hl-line-mode + all-the-icons-dired-mode
- Dirvish
- Header display
Ranger uses
header-line-format
to show the header, this approach leads to misaligned/mismatched header string when you have multiple parent windows. In contrast, dirvish uses posframe for that purpose.- Ranger
- Dirvish
- Preview buffer
Ranger uses dired for creating both parent buffers and directory preview buffer, which causes a lot of undesirable behaviours. Because when you have multiple ranger instance running, a ranger buffer can be both a parent buffer in INSTANCE-1 and a preview buffer in INSTANCE-2. In this case, update INSTANCE-1 inevitably mutate the state of INSTANCE-2, which is definitely not what we want.
In ranger, it’s quite difficult to customize the setup of a preview buffer. The reason is, again, a preview buffer can either be a dired buffer or Non-dired buffer.
To avoid this confusion, dirvish use external shell command (
exa
by default) for directory preview, so a preview buffer would never be a dired buffer. Also, you can customize the setup for preview buffer withdirvish-preview-setup-hook
anddirvish-preview-cmd-alist
. - Keybindings
Dirvish does not introduce any keybindings by default, see
dirvish-mode-map
for more details.
TODO
- You may experience some issue with Windows since dirvish has not been tested on it
- It might have conflicts with packages that controls window placement.
Feel free to report issues.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http:https://www.gnu.org/licenses/.