Emacs From Scratch #10 - Effortless File Management with Dired

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024

Комментарии • 45

  • @wakamenod9556
    @wakamenod9556 3 года назад +29

    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")))

  • @jhonrocha6632
    @jhonrocha6632 3 года назад +4

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

  • @shengyang6759
    @shengyang6759 3 года назад +4

    Instead of for ivy-immediate-done, which is hard to discover and remember, you can press to move the selection line of current candidate to the line you are typing, and press .

    • @SystemCrafters
      @SystemCrafters  3 года назад

      Thanks Sheng! doesn't actually work for me, not sure why. I'd be glad if it did because you're right, it's easier to remember!

    • @shengyang6759
      @shengyang6759 3 года назад +1

      @@SystemCrafters You may need to set (setq ivy-use-selectable-prompt t). See: github.com/abo-abo/swiper#frequently-asked-questions

  • @diegonayalazo
    @diegonayalazo 2 года назад

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

  • @hackerzol
    @hackerzol 3 года назад +10

    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.

  • @GeorgeInTech
    @GeorgeInTech 3 года назад +3

    Thank you for another great episode David

  • @jonas9437
    @jonas9437 3 года назад +3

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

    • @SystemCrafters
      @SystemCrafters  3 года назад +2

      Thanks a lot! Wow, I had never heard of `browse-url-of-dired-file` before, it seems to work pretty well for opening the right program. Great to see there's a decent built-in solution!

  • @SamWhitlock
    @SamWhitlock 3 года назад +2

    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!)

  • @DanielMartinez-yv9gp
    @DanielMartinez-yv9gp 3 года назад +2

    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".

  • @gzoechi
    @gzoechi 3 года назад

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

  • @GabrielPozo
    @GabrielPozo Год назад

    Thanks for sharing this kind of content

  • @rhblind
    @rhblind 2 года назад

    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.

  • @auroradraco9974
    @auroradraco9974 4 года назад

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

    • @SystemCrafters
      @SystemCrafters  4 года назад +2

      Thanks a lot, I'm glad if it brings new people to Emacs, it's a fantastic program!

    • @auroradraco9974
      @auroradraco9974 4 года назад

      @@SystemCrafters yeah, I made a post about wanting to start a new emacs config in reddit and I was recommended this series (by I am assuming you). I dont regret clicking it, these videos are awesome. Although I am not watching them in the order they came out, as I dont have 10 hours to sit through in a single day or sth but in the order of my interest and they are great. I do hope you get more recognition, you deserve it!!

    • @SystemCrafters
      @SystemCrafters  4 года назад

      Thanks a lot! The videos definitely don't need to be watched in order, thankfully there isn't a lot of dependency between them even though I treat them as a series

    • @auroradraco9974
      @auroradraco9974 4 года назад

      @@SystemCrafters yeah, thats what I would say as well

  • @magnum333
    @magnum333 2 года назад +1

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

  • @charlesthurlo9128
    @charlesthurlo9128 4 года назад +1

    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

    • @SystemCrafters
      @SystemCrafters  4 года назад +1

      Thanks a lot! Good news, I'm starting a new series about EXWM next Friday!

    • @charlesthurlo9128
      @charlesthurlo9128 4 года назад

      @@SystemCrafters Omg thanks so much man exicted

  • @twanschoonen6823
    @twanschoonen6823 3 года назад +1

    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

    • @SystemCrafters
      @SystemCrafters  3 года назад

      Thanks! I will definitely be covering this in a future video

  • @TheCraigeth
    @TheCraigeth 2 года назад

    If you've not found it yet, you can auto refresh dired buffers by setting dired-auto-revert-buffer to t

  • @mastergamer4335
    @mastergamer4335 2 года назад

    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.

  • @halfacanuck
    @halfacanuck 2 года назад

    I cannot for the life of me get dired-open working with use-package, even with exactly the same invocation: it simply wouldn't load. Nor would it load with ":commands dired", nor with ":after dired". The only way I could get it to _attempt_ to load is with ":hook dired-mode", but then I got complaints that autoload couldn't define the function `dired-open`. No idea what that means, and no other error messages. I got it working once by requiring it manually and setq-ing dired-open-extensions, but that defeats the point of use-package, surely. Dunno if it's a bug in dired-open, in use-package, in autoload.el, or in my approach. I'll just reimplement it.
    Learned some things about dired in this one, thanks!

  • @alexei3366
    @alexei3366 3 года назад

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

  • @abhijitpaul7683
    @abhijitpaul7683 3 года назад

    For evil collection, Shift+j invokes the dired-goto-file command instead of j.

  • @richardfrangie3518
    @richardfrangie3518 2 года назад

    👍

  • @diredbeats2709
    @diredbeats2709 3 года назад

    super

  • @capability-snob
    @capability-snob 4 года назад

    Dired in same directory as file -> C-x f (find-file) C-d (dired), no configuration needed.

  • @johnc3403
    @johnc3403 3 года назад +1

    Anyone else need to Google the carrot key? :D Apparently it's the ^ key and it's actual name is the caret.

    • @SystemCrafters
      @SystemCrafters  3 года назад

      They are pronounced the same in US English unfortunately :)

  • @capability-snob
    @capability-snob 4 года назад +1

    Stop ido autocompletions -> C-f

  • @pouet4608
    @pouet4608 Год назад

    And M-x locate.