-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinit-dired.el
56 lines (51 loc) · 1.87 KB
/
init-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
;; init-dired.el --- config for dired-mode -*- lexical-binding: t -*-
(keymap-set dired-mode-map "C-c C-o" 'crux-open-with)
(setq completion-ignored-extensions
(append completion-ignored-extensions
'("./" "../" ".xlsx" ".docx" ".pptx" ".DS_Store")))
;; "dired-mode-map"
;; Use build-in `wdired-mode'.
;; (keymap-set dired-mode-map "R" 'wdired-change-to-wdired-mode)
;; http://elpa.gnu.org/packages/gited.html
(when (require 'gited nil t)
(keymap-set dired-mode-map "C-x C-g" 'gited-list-branches))
;; https://github.com/Fuco1/dired-hacks
(when (require 'dired-narrow nil t)
(keymap-set dired-mode-map "/" 'dired-narrow))
(require 'dired-du nil t)
(when (require 'ivy-dired-history nil t)
;; ivy-dired-history-variable は,session.el で明示的に管理中.
;; check session-globals-include
(keymap-set dired-mode-map "," 'dired))
(declare-function dired-extra-startup "dired-x")
(when (require 'dired-x nil t)
(dired-extra-startup))
(defun my-reveal-in-finder ()
"Reveal the current buffer in Finder."
(interactive)
(shell-command-to-string "open ."))
;; dired-x を読み込んだあとじゃないとだめ
(keymap-set dired-mode-map "F" 'my-reveal-in-finder)
;; 上位ディレクトリへの移動
(keymap-set dired-mode-map "u" 'dired-up-directory)
;; Finder を使ったファイルオープン
(keymap-set dired-mode-map "f" 'ns-open-file-using-panel)
(keymap-set dired-mode-map "C-M-p" (lambda () (interactive) (other-window -1)))
(keymap-set dired-mode-map "C-M-n" (lambda () (interactive) (other-window 1)))
;; https://github.com/xuchunyang/emacs.d
;; type "!" or "X" in dired
(when (eq system-type 'darwin)
(setq dired-guess-shell-alist-user
(list
(list (rx (and "."
(or
;; Videos
"mp4" "avi" "mkv" "rmvb"
;; Torrent
"torrent"
;; PDF
"pdf"
;; Image
"gif" "png" "jpg" "jpeg")
string-end)) "open"))))
(provide 'init-dired)