peep dired - view files from dired

Hello all,

I use emacs on a daily basis and sometimes going through the downloads folder it has several files with different names that do not relate to the image or the file content, so I need to have some means of viewing the file or image before doing any action on it, such as moving, deleting, renaming, etc…

For this, I saw a youtube clip from DistroTube where he showcased the use of a great package called peep-dired that you can activate the peep-dired-mode then move to the next file and it will show the file content which is quite useful.

You can activate this package by the following code:

in package.el add the line

(package! peep-dired)

in config.el add the lines

;; Add the j and k keys to move to next and previous files in peed-dired mode
(evil-define-key 'normal peep-dired-mode-map
  (kbd "j") 'peep-dired-next-file
  (kbd "k") 'peep-dired-prev-file)
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)

;; Add the key binding SPC d p to toggle peep-dired-mode while in dired (you can add the key binding you like)
(map! :leader
       (:after dired
        (:map dired-mode-map
         :desc "peep mode" "d p" #'peep-dired)))

Hope this will help spread the knowledge

output2

1 Like

Just tried it out, this works flawlessly. Also works for directories which is a nice bonus.

Thanks a lot for sharing, I’ll be using this daily!

1 Like

I’m glad I helped :slightly_smiling_face:

Thanks!

If you like the ranger style of file browsing, this also works with the +ranger flag of the :emacs dired module. You can use z P to toggle between the (initial) ranger minimal mode and the “full” ranger mode. The full mode includes file previews (also code-highlighted).

1 Like