-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmatcha-dired.el
174 lines (158 loc) · 6.32 KB
/
matcha-dired.el
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
;;; matcha-dired.el --- Integration with Transient. -*- lexical-binding: t -*-
;; Copyright (C) 2019 James Nguyen
;; Author: James Nguyen <james@jojojames.com>
;; Maintainer: James Nguyen <james@jojojames.com>
;; URL: https://github.com/jojojames/matcha
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: transient, emacs
;; HomePage: https://github.com/jojojames/matcha
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Integration with Transient.
;;; Code:
(require 'matcha-base)
(require 'dired)
(matcha-create-0-prefixed-fn dired-copy-filename-as-kill)
(matcha-create-universal-argument-prefixed-fn dired-copy-filename-as-kill)
(defun matcha-dired-find-file ()
"Like `find-file' but with `default-directory' set to the
one specified by listing header."
(interactive)
(let ((default-directory (dired-current-directory)))
(call-interactively #'find-file)))
(transient-define-prefix matcha-dired-mode ()
"Dired"
[["Actions"
("f" "Find File" matcha-dired-find-file)
("d" "Delete File" dired-do-delete)
("r" "Rename File" dired-do-rename)
("c" "Copy File" dired-do-copy)
("+" "Create Directory" dired-create-directory)]
["Menu"
("m" "Mark..." matcha-dired-mark)
("o" "Operate..." matcha-dired-operate)
("%" "Regexp..." matcha-dired-regexp)
("i" "Immediate..." matcha-dired-immediate)]
["Misc"
("q" "Wdired" wdired-change-to-wdired-mode)
("Q" "Exit Wdired" wdired-finish-edit)
("R" "Query Replace" dired-do-query-replace-regexp)]
["Filesnames"
("yy" "Copy Full Filename" matcha-zero-prefixed-dired-copy-filename-as-kill)
("yY" "Copy Relative Filename" matcha-u-prefixed-dired-copy-filename-as-kill)
("Y" "Copy Filename" dired-copy-filename-as-kill)]])
(transient-define-prefix matcha-dired-operate ()
"Operate"
[["Actions"
("d" "Delete" dired-do-delete)
("r" "Rename" dired-do-rename)
("c" "Copy" dired-do-copy)
("@" "Shell Command" dired-do-shell-command)
("!" "Async Shell Command" dired-do-async-shell-command)]
["Ownership"
("cw" "Chown" dired-do-chown)
("cm" "Chmod" dired-do-chmod)
("cg" "Chgrp" dired-do-chgrp)
("t" "Touch" dired-do-touch)]
["Encryption"
("zz" "Compress" dired-do-compress)
("ze" "Encrypt" epa-dired-do-encrypt)
("zd" "Decrypt" epa-dired-do-decrypt)
("zv" "Verify" epa-dired-do-verify)
("zs" "Sign" epa-dired-do-sign)]]
[["Search"
("f" "Search for Files" dired-do-search)
("sr" "ISearch Regexp" dired-do-isearch-regexp)
("ss" "ISearch" dired-do-isearch)
("q" "Query Replace" dired-do-query-replace-regexp)]
["Images"
("id" "Delete Tag" image-dired-delete-tag)
("it" "Tag Files" image-dired-tag-files)
("ic" "Comment Files" image-dired-dired-comment-files)
("is" "Display Thumbnails" image-dired-display-thumbs)]
["Misc"
("el" "Load Elisp" dired-do-load)
("eb" "Byte Compile Directories" dired-do-byte-compile)
("p" "Print" dired-do-print)
("h" "Hardlink" dired-do-hardlink)
("l" "Symlink" dired-do-symlink)]])
(transient-define-prefix matcha-dired-mark ()
"Mark"
[["Mark"
("m" "Mark" dired-mark)
("u" "Unmark" dired-unmark)
("C" "Change Marks" dired-change-marks)
("T" "Toggle Marks" dired-toggle-marks)]
["Mark All"
("U" "Unmark All" dired-unmark-all-marks)
("S" "Symlinks" dired-mark-symlinks)
("D" "Directories" dired-mark-directories)
("X" "Executables" dired-mark-executables)]]
[["Flag for Deletion"
("d" "Mark for Deletion" dired-flag-file-deletion)
("g" "Garbage" dired-flag-garbage-files)
("b" "Backups" dired-flag-backup-files)
("s" "Autosaves" dired-flag-auto-save-files)
("c" "Clean Directory" dired-clean-directory)]
["Navigation"
("[" "Previous" dired-prev-marked-file)
("]" "Next" dired-next-marked-file)]])
(transient-define-prefix matcha-dired-regexp ()
"Regexp"
[["Mark"
("*" "Mark for Regexp" dired-mark-files-regexp)
("g" "Mark files containings Regexp" dired-mark-files-containing-regexp)
("t" "Image Tags for Regexp" image-dired-mark-tagged-files)]
["Apply"
("r" "Rename" dired-do-rename-regexp)
("c" "Copy" dired-do-copy-regexp)
("d" "Flag for Deletion" dired-flag-files-regexp)
("u" "Upcase" dired-upcase)
("l" "Downcase" dired-downcase)]
["Link"
("h" "Hardlink" dired-do-hardlink-regexp)
("s" "Symlink" dired-do-symlink-regexp)]])
(transient-define-prefix matcha-dired-immediate ()
"Immediate"
[["Find"
("ff" "Find" find-file)
("fv" "View" dired-view-file)
("fd" "Display" dired-display-file)
("fo" "Find in Other Window" dired-find-file-other-window)
("fp" "Find at Point" dired-find-file)]
["Misc"
("hd" "Hide Details in Buffer" dired-hide-details-mode)
("d" "Create Directory" dired-create-directory)
("r" "Refresh Buffer" revert-buffer)
("ww" "Wdired" wdired-change-to-wdired-mode)
("wq" "Finish Wdired" wdired-finish-edit)]]
[["Compare"
("cd" "Directories" dired-compare-directories)
("cb" "With Backup" dired-backup-diff)
("cf" "With another File" dired-diff)]
["Search"
("ss" "ISearch" dired-isearch-filenames)
("sr" "ISearch Regexp" dired-isearch-filenames-regexp)]
["Images"
("ii" "Display" image-dired-dired-display-image)
("ie" "Display Externally" image-dired-dired-display-external)
("it" "Toggle Thumbnails" image-dired-dired-toggle-marked-thumbs)]])
(defun matcha-dired-set-launcher ()
"Set up `dired' with `transient'."
(matcha-set-mode-command :mode 'dired-sidebar-mode :command #'matcha-dired-mode)
(matcha-set-mode-command :mode 'dired-mode :command #'matcha-dired-mode))
(provide 'matcha-dired)
;;; matcha-dired.el ends here
;; Local Variables:
;; byte-compile-warnings: (not free-vars unresolved noruntime cl-functions obsolete)
;; End: