Emacs From Scratch #10 - Effortless File Management with Dired

preview_player
Показать описание
In this stream, we'll continue creating a completely custom Emacs configuration from scratch. This time we'll be learning how to use and configure the built-in Dired package to make file management so easy that you'll never need to open a file browser program again!

Follow me on Twitter for more Emacs content!

Intro music: Coriolis Effect by logos feat. stefsax, licensed CC-BY
Рекомендации по теме
Комментарии
Автор

1:02 - Intro
2:16 - About emacs-from-scratch Configuration
2:40 - Dired Basics (Invocation / Navigation)
9:54 - Dired Basics (Configuration)
14:51 - Dired Basics (File Operations)
20:48 - Dired Basics (Copying and Renaming files)
24:00 - Chat Topics (dealing with Ivy completion, `dired-dwim-target`, etc..)
27:16 - Dired Basics (Deleting files)
28:45 - Dired Basics (Creating and extracting archives)
31:35 - Dired Basics (Other common operations)
34:49 - Chat Topics (`wdired-exit`)
36:15 - Single Dired buffer
40:03 - File icons
41:11 - Open external files
46:04 - Hide / show dotfiles
48:10 - Chat Topics (`dired-maybe-insert-subdir`)
49:07 - Renaming files using regular expressions
52:52 - Chat Topics (`dired-omit-mode`)
53:10 - About another new series
53:50 - Outro

*One thing I noticed about the configuration:
On MacOS, `ls` command(BSD) does not have --group-directories-first option, which leads to the error "insert-directory: Listing directory failed but `access-file' worked" at dired invocation.
To avoid that, I needed to install coreutils and then set GNU `ls` to be used as below.

(use-package dired
:ensure nil
:commands (dired dired-jump)
:config
(setq dired-dwim-target t)
(when (string= system-type "darwin")
(setq insert-directory-program "/usr/local/bin/gls"))
:custom ((dired-listing-switches "-agho --group-directories-first")))

wakamenod
Автор

Thank you a lot for this series, David! Now I am living on Emacs all time, using eshell and dired as main drivers! Nice!

jhonrocha
Автор

You are a role model for quality content. Congrats my friend. Learning every day with you as a teacher 😊👍

diegonayalazo
Автор

Instead of <C-M-j> for ivy-immediate-done, which is hard to discover and remember, you can press <C-p> to move the selection line of current candidate to the line you are typing, and press <RET> .

shengyang
Автор

Thank you for another great episode David

GeorgeInTech
Автор

25:38 in case anyone forgets that `ivy-done` thing, if you go up one line (k in evil mode) it will select the line you're typing on and enter it as you typed it.

Maybe not as slick as ivy immediate done, but very easy to remember (to just "scroll" over the thing you want -> what you typed in!)

SamWhitlock
Автор

You do a damn good job! Educational & Entertaining.

Ggldoork
Автор

If you are using evil, regexp grouping works with \( and \), although you may be able to change it in the configuration.
It may also work like that in default emacs.

For example, the regexp to replace file name (51:09) should have been ^My\(hab\), and then \1 would have contained "hab".

DanielMartinez-yvgp
Автор

I believe the reason dired always opens directories in a new window and persist is because of tramp. When you are listing files remotely it's very helpful to not have to rebuild that listing every time you navigate back and forth, especially if you have directories with lots of files.

hackerzol
Автор

Thanks for the incredible video. This series is great for new people looking to get into emacs

auroradraco
Автор

Thanks for dired-dwim-target, was looking for something like this ♥️

gzoechi
Автор

Thanks for sharing this kind of content

GabrielPozo
Автор

This is great content, thank you! Just a quick hint, where I wonder why it is so rarely mentioned: in dired <browse-url-of-dired-file> (bound to W in doom-emacs/evil?!) opens files in the default programm (at least on Ubuntu). It's super convenient for me!

jonas
Автор

man I missed it this video series is amazing please don't stop making it its so helpful also could you possibly make a tutorial on exwm because there's not much resources about it

charlesthurlo
Автор

I am getting an error that "Package ‘dired-single’ is unavailable", has that been removed since this video?

tylerallen
Автор

Wonderful video! I've been wanting to learn dired a long time, and now I have :)

As for problems with *dired-open* and using the _dired-open-xdg_ function, I simply override the function (I'm also on a Mac, so I'll use _open_ instead of _xdg-open_ command).

(eval-after-load "dired-open"
(when (eq system-type 'darwin)
'(defun dired-open-xdg ()
"Try to run `open' to open the file under point as long as the `file' is a regular file."
(interactive)
(if (executable-find "open") ;; use `open' instead of `xdg-open'
(let ((file (ignore-errors (dired-get-file-for-visit))))
;; TODO - Add check to ignore archives, as I'd like to keep the
;; dired functionality of peeking inside them
(if (f-file-p file) ;; add an extra check for regular files here
(start-process "dired-open" nil
"open" (file-truename file)) nil)) nil))))

This seems to work pretty good so far for my use.

rhblind
Автор

To solve the problem of having multiple dired buffers open, use the dired-find-alternate-file function which is bound to a

magnum
Автор

Nice series, I would also be interested in optimizing emacs' performance. I think about garbage collection setup, early-init, gccemacs and profiling where the problem is if emacs gets slow

twanschoonen
Автор

Can you cover how to read json files in Elisp please? I would wanna have a settings.json and change values of widths, heights, colors, everything in that file, and have Emacs read that file and with that configure everything.

mastergamer
Автор

Linux. How in dired mode show Trash folder and restore files from it?

alexei
join shbcf.ru