-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathquick-find.el
49 lines (46 loc) · 1.79 KB
/
quick-find.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
(use-package bind-key
:ensure t)
(defun dired-timesort (filename &optional wildcards)
(let ((dired-listing-switches "-lhat"))
(dired filename wildcards)))
(defmacro quick-find (key file &optional path find-args)
`(bind-key
,key
(cond
((stringp ,find-args)
'(lambda (&optional arg)
(interactive)
(find-dired (expand-file-name ,file ,path) ,find-args)))
((and
;; (not (tramp-tramp-file-p (expand-file-name ,file ,path)))
(or (file-directory-p (expand-file-name ,file ,path))
(not (file-exists-p (expand-file-name ,file ,path)))))
'(lambda (&optional arg)
(interactive)
(dired-timesort (expand-file-name ,file ,path))))
(t
'(lambda (&optional arg)
(interactive)
(find-file (expand-file-name ,file ,path)))))))
;;; Files
(quick-find "C-h C-`" "~/")
(quick-find "C-h C-t" "/tmp/")
;; (quick-find "C-h C-e" "/sudo::/etc/")
(quick-find "C-h C-x C-o" "~/org")
(quick-find "C-h C-o" "~/Documents")
(quick-find "C-h C-d" "~/Downloads")
(quick-find "C-h C-i" user-init-file)
(quick-find "C-h C-x C-u" custom-file)
(quick-find "C-h C-x C-k" user-keys-file)
(quick-find "C-h C-x C-c" "Cask" user-emacs-directory)
(quick-find "C-h C-x C-e" (format ".cask/%s/elpa/" emacs-version) user-emacs-directory)
(quick-find "C-h C-x e" "emacs" "~/workspace")
(quick-find "C-h C-x C-q" "quick-find.el" user-emacs-directory)
(quick-find "C-h C-x C-w" "~/workspace")
(quick-find "C-h C-x p" "~/Pictures")
(quick-find "C-h C-x C-s" "~/.ssh/config")
(quick-find "C-h C-x C-b" "~/.bash_profile")
;; (quick-find "C-h C-x C-b" (crux-find-shell-init-file))
(quick-find "C-h C-x C-s" "~/.ssh/config")
;; (quick-find "C-h C-x C-h" "/sudo::/etc/hosts")
(quick-find "C-h C-x s" "settings.el" user-emacs-directory)