;;; dired.el --- Configuration for dired -*- lexical-binding: t; -*- ;;; Commentary: Dired is the main mode for Emacs file-manager operations. The name “Dired” stands for “directory editor”. ;;; Code: ;;; Docs: https://www.emacswiki.org/emacs/DiredMode (defun user--dired-mode-hook () "Mode hook for dired." (with-feature 'async ;; Asynchronous operations in dired. (dired-async-mode t))) (use-package dired :ensure nil :defer :config (validate-setq ;; Always copy recursively without asking. dired-recursive-copies 'always ;; Ask once when recursively deleting a directory. dired-recursive-deletes 'top ;; Allow dired to be smart about operations. dired-dwim-target t ;; Default flags for ls. dired-listing-switches "-alh") ;;; (Packages) ;;; ;; https://github.com/purcell/diredfl ;; Extra font lock rules for a more colourful dired (use-package diredfl :disabled) ;; https://github.com/emacsorphanage/dired-k ;; highlights dired buffer like k. (use-package dired-k :disabled) ;; https://github.com/clemera/dired-git-info ;; This Emacs packages provides a minor mode which shows git information inside the dired buffer (use-package dired-git-info :disabled :bind (:map dired-mode-map (")" . dired-git-info-mode))) ;; https://github.com/jwiegley/emacs-async ;; async.el is a module for doing asynchronous processing in Emacs. (use-package async) ;; https://github.com/juan-leon/dired-efap ;; dired-efap.el allows the user to edit the filename at point, by hitting a key (like f2) or double-clicking it. (use-package dired-efap :config ;;; (Bindings) ;;; (define-key dired-mode-map [R] 'dired-efap) (when (display-graphic-p) (define-key dired-mode-map [down-mouse-1] 'dired-efap-click)) (with-eval-after-load 'dired ;; Load dired-efap when dired is loaded. (require 'dired-efap))) ;; https://github.com/jtbm37/all-the-icons-dired ;; This adds dired support to all-the-icons. (use-package all-the-icons-dired :if window-system) ;; https://github.com/stsquad/dired-rsync ;; This package adds a single command dired-rsync which allows the user to copy marked files in a dired buffer via rsync. (use-package dired-rsync :disabled :if (executable-find "rsync") :bind (:map dired-mode-map ("C-c C-r" . dired-rsync))) ;; https://github.com/vifon/dired-recent.el ;; A history of paths visited with Emacs dired. (use-package dired-recent :disabled :config (validate-setq ;; Path to history database. dired-recent-directories-file (path-join *user-cache-directory* "dired-history")) (dired-recent-mode t)) ;;; (Bindings) ;;; ;; Do not open new buffers when going down or up a directory. (define-key dired-mode-map (kbd "") 'dired-find-alternate-file) (define-key dired-mode-map (kbd "^") (lambda () (interactive) (find-alternate-file ".."))) (when (display-graphic-p) (define-key dired-mode-map [double-mouse-1] 'dired-find-file))) (provide 'utilities/dired) ;;; dired.el ends here