From 4c4fbf6980906fdf57028d56995c621fbe8cdff7 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 21 Aug 2022 17:44:13 +0100 Subject: (Emacs)+dired insert all subdirectories -dired display functions Just a nice bit of functionality, also added bindings for stuff I've needed when using dired recently. --- Emacs/.config/emacs/config.org | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'Emacs/.config/emacs') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index a4767dd..95ce998 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -1460,24 +1460,13 @@ are some corners I'd like to adjust). :config (with-eval-after-load "evil-collection" (evil-collection-dired-setup)) - (defun +dired/display-thumb-or-file () - "If the file under point is a image file then display a -thumb, otherwise open the file." + + (defun +dired/insert-all-subdirectories () + "Insert all subdirectories currently viewable." (interactive) - (let* ((filename (dired-get-filename)) - (ext (file-name-extension filename))) - (if (or (string= ext "png") - (string= ext "jpg") - (string= ext "jpeg") - (string= ext "gif")) - (image-dired-display-thumb) - (find-file-other-frame filename)))) - - (defun +dired/maybe-frame (&optional ARG) - (interactive "P") - (if ARG - (call-interactively #'dired-other-frame) - (call-interactively #'dired))) + (dired-mark-directories nil) + (mapcar #'dired-insert-subdir (dired-get-marked-files)) + (dired-unmark-all-marks)) (nmmap :keymaps 'dired-mode-map @@ -1487,8 +1476,8 @@ thumb, otherwise open the file." (local-leader :keymaps 'dired-mode-map "l" #'dired-maybe-insert-subdir - "u" #'dired-undo - "i" #'+dired/display-thumb-or-file)) + "m" #'dired-mark-files-regexp + "u" #'dired-undo)) #+end_src *** fd-dired -- cgit v1.2.3-13-gbd6f