 ;;    To make it copy the absolute path: `0 w'
 
 ;; (3) To copy the path to the folder you’re looking at in dired: `M-< w'
+
+;; http://truongtx.me/2013/04/24/dired-as-default-file-manager-1-introduction

;; Time-stamp: <2015-06-04 11:16:15 kmodi>

;; dired, dired-x, dired+, dired-single
;; http://www.emacswiki.org/emacs-en/dired-single.el
;; http://truongtx.me/2013/04/24/dired-as-default-file-manager-1-introduction

(use-package dired-single
  :commands (dired dired-single-magic-buffer-current-dir dired-single-magic-buffer)
  :init
  (progn
    (bind-keys
     :map modi-mode-map
      ;; Change the default `C-x C-d` key binding from `ido-list-directory'
      ("C-x C-d" . dired-single-magic-buffer-current-dir)
      ;; Change the default `C-x C-j` key binding from `dired-jump'
      ;; Opens dired-single-magic-buffer but asks which directory to open that
      ;; dired buffer for.
      ("C-x C-j" . dired-single-magic-buffer)))
  :config
  (progn
    (setq dired-recursive-deletes 'always)

    ;; in the prompt for file copy, rename etc.
    (setq dired-dwim-target t)

    (defun modi/dired-rename-buffer-name ()
      "Rename the dired buffer name to distinguish it from file buffers.
It added extra strings at the front and back of the default dired buffer name."
      (let ((name (buffer-name)))
        (if (not (string-match "/$" name))
            (rename-buffer (concat "*Dired* " name "/") t))))

    (defun modi/dired-truncate-lines ()
      (toggle-truncate-lines 1))

    (add-hook 'dired-mode-hook #'modi/dired-rename-buffer-name)
    (add-hook 'dired-mode-hook #'modi/dired-truncate-lines)

    (use-package dired-x
      :config
      (progn
        (setq dired-omit-verbose nil)
        ;; hide backup, autosave, *.*~ files
        ;; omit mode can be toggled using `M-o' in dired buffer
        (add-hook 'dired-mode-hook #'dired-omit-mode)))

    ;; http://www.emacswiki.org/DiredPlus
    (use-package dired+
      :init
      (progn
        ;; detail toggling is bound to "(" in `dired-mode' by default
        (setq diredp-hide-details-initially-flag nil))
      :config
      (progn
        ;; Privilege indicator faces
        (defun modi/dired-update-privilege-faces ()
          (set-face-attribute 'diredp-dir-priv nil
                              :foreground "#7474FFFFFFFF"
                              :background (face-background 'default))
