The following customizations make emacs dired mode behave in a similar fashion to other file browsing tools such as midnight commander. While there are many great file management tools out there. I keep coming back to emacs dired because of the keyboard commands and flexibility.
(use-package dired
:straight (:type built-in)
:defer t
:custom
<<dired_custom>>)
This will cause emacs to default to moving/copying/renaming files from the directory in one dired buffer to another in a split-window. This will allow emacs to operate more like midnight commander, total commander, double commander, etc.
(dired-dwim-target t)
Wdired, allow for a writable dired buffer. This makes it easy to rename files in dired buffers.
(use-package wdired-mode
:straight (:type built-in)
:defer t
:custom
<<wdired_custom>>)
Wdired allows for manual editing of file premissions when wdired-allow-to-change-permissions
is set to true.
(wdired-allow-to-change-permissions t)
Dired Hacks is a series of modifications to add features to Dired.
Dired colapse will show the full path in a dired buffer for paths that contain only a single file.
(use-package dired-collapse
:straight t
:after dired
:hook
(dired-mode . dired-collapse-mode))
Dired Open adds extra hooks to dired-find-file
which search for alternative ways to open files in Dired.
(use-package dired-open
:straight t
:after dired
:init
<<dired_open_init>>
:config
<<dired_open_config>>)
When opening files in Emacs such as media files, xdg-open
can be used to open the preferred application for that particular file extension. Dired Open has a function dired-open-xdg
that will open the file on the current line in Dired using xdg-open
.
First, whicher
can be used to see if xdg-open
is installed on the system.
(whicher "xdg-open")
The following line will bind the o
key to dired-open-xdg
:
(define-key dired-mode-map (kbd "o") #'dired-open-xdg)
This can also be configured to work in Sunrise Commander using the sr-mode-map
:
(define-key sr-mode-map (kbd "o") #'dired-open-xdg)
Disc usage is a tool that can be used to determine the amount of memory a directory uses in the file system.
(use-package disk-usage
:straight t
:defer t)
(use-package async
:straight t
:defer t
:init
(autoload 'dired-async-mode "dired-async.el" nil t)
:hook
(dired . dired-async-mode))
Rclone tools is a package that used the Emacs completing-read
function to simplify running the rclone
program from within Emacs and make it simpler to create scripts using Emacs lisp.
(use-package rclone-tools
:straight (rclone-tools :host github
:repo "tfree87/emacs-rclone-tools"
:branch "main")
:defer t
:init (whicher "rclone"))
The following function will execute the rclone command line tool
(defun rclone-sync (source dest &optional rclone-path rclone-config)
"Sync DEST with SOURCE using rclone.
The path to the rlcone executable can be set with RCLONE-PATH.
The rclone configuration can be set with RCLONE-CONFIG."
(interactive)
(let ((rclone-path (or rclone-path "rclone"))
(rclone-config (or rclone-config nil))
(config-option
(if rclone-config
(concat " --config " rclone-config)
(nil))))
(eshell-command
(concat rclone-path
config-option
" -vP sync "
source
" "
dest))))
Tell Emacs what feature this file provides.
(provide 'freemacs-dired)
;;; freemacs-dired.el ends here