-
Notifications
You must be signed in to change notification settings - Fork 0
/
anything-config.el
70 lines (59 loc) · 3.58 KB
/
anything-config.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
(setq anything-sources `(((name . "Buffers")
(candidates
. (lambda ()
(remove-if (lambda (name)
(or (equal name anything-buffer)
(eq ?\ (aref name 0))))
(mapcar 'buffer-name (buffer-list)))))
(type . buffer))
((name . "File Name History")
(candidates . file-name-history)
(match (lambda (candidate)
;; list basename matches first
(string-match
anything-pattern
(file-name-nondirectory candidate)))
(lambda (candidate)
;; and then directory part matches
(let ((dir (file-name-directory candidate)))
(if dir
(string-match anything-pattern dir)))))
(type . file))
((name . "Files from Current Directory")
(init . (lambda ()
(setq anything-default-directory
default-directory)))
(candidates . (lambda ()
(if (and
(not (equal (substring anything-default-directory 0 5) "/ssh:"))
(not (equal (substring anything-default-directory 0 6) "/root@")))
(directory-files anything-default-directory))))
(type . file) )
((name . "Manual Pages")
(candidates . ,(progn
;; XEmacs doesn't have a woman :)
(declare (special woman-file-name
woman-topic-all-completions))
(condition-case nil
(progn
(require 'woman)
(woman-file-name "")
(sort (mapcar 'car
woman-topic-all-completions)
'string-lessp))
(error nil))))
(action . (("Open Manual Page" . woman)))
(requires-pattern . 2))
((name . "Complex Command History")
(candidates . (lambda ()
(mapcar 'prin1-to-string
command-history)))
(action . (("Repeat Complex Command" .
(lambda (c)
(eval (read c))))))
(delayed))))
(define-key anything-map "\C-s" 'anything-isearch)
(define-key anything-map "\C-p" 'anything-previous-line)
(define-key anything-map "\C-n" 'anything-next-line)
(define-key anything-map "\C-v" 'anything-next-page)
(define-key anything-map "\M-v" 'anything-previous-page)