summaryrefslogtreecommitdiff
path: root/dired-conf.el
blob: 512ee3ab292811652142a845835d70c9e071100a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
;;; dired-conf.el --- Configurations related to dired  -*- lexical-binding: t; -*-

;; Copyright (C) 2021  李俊緯

;; Author: 李俊緯 <mmemmew@gmail.com>
;; Keywords: data, files, hardware, unix

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.

;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see
;; <https://www.gnu.org/licenses/>.

;;; Commentary:

;; This file configures dired and related packages, including
;; trashed.el.

;;; Code:

;;; normal settings

(require 'dired)
(require 'dired-x)
(require 'files)

(set 'insert-directory-program "gls")

(set 'dired-listing-switches
     "-alh --dired --group-directories-first --time-style=long-iso")

(setq dired-dwim-target t)

(add-hook 'dired-mode-hook #'hl-line-mode)

(require 'rx)

(setq dired-garbage-files-regexp (rx (or "aux" "bak" "dvi" "log"
                                         "orig" "rej" "toc" "out"
                                         "nav" "snm")
                                     eos))

(require 'dired-aux)

(setq dired-isearch-filenames 'dwim)
(setq dired-create-destination-dirs 'ask)
(setq dired-vc-rename-file t)

(require 'wdired)

(setq wdired-allow-to-change-permissions t)
(setq wdired-create-parent-directories t)

(require 'image-dired)

(setq image-dired-external-viewer "open")

;;; trash settings

;; I tried the package trashed, but it does not support the trash can
;; on macOS.

(set 'delete-by-moving-to-trash nil)
(set 'trash-directory "/Users/durand/.Trash/")

(provide 'dired-conf)
;;; dired-conf.el ends here