blob: 8867bb8d59be1d76b5e082e1a28dc826417220d2 (
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
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
|
;; Time-stamp: <2019-09-09 22:10:08 (tslil@basingstoke)>
(use-package amx :ensure t)
(use-package counsel :ensure t
:after amx
:demand
:defines (counsel-for-files)
:bind (("C-s" . counsel-grep-or-swiper)
("C-x f" . counsel-recentf)
("C-x l" . counsel-locate)
("C-c C-r" . ivy-resume)
("C-c g" . counsel-rg)
("M-x" . counsel-M-x)
("C-s" . swiper-isearch)
:map ivy-minibuffer-map
("C-m" . ivy-alt-done)
:map swiper-map
("M-%" . swiper-query-replace))
:config
(setq ivy-use-virtual-buffers nil
ivy-display-style 'fancy
ivy-initial-inputs-alist nil
ivy-format-function 'ivy-format-function-line
ivy-count-format "")
(setq swiper-use-visual-line t)
(setq counsel-find-file-at-point t
counsel-grep-base-command
"rg -i -M 120 --no-heading --line-number --color never '%s' %s"
counsel-describe-function-function 'helpful-function
counsel-describe-variable-function 'helpful-variable)
(ivy-mode t)
(counsel-mode t))
(use-package ivy-rich :ensure t
:config
(setq ivy-rich-path-style 'abbrev
ivy-rich-display-transformers-list
'(ivy-switch-buffer
(:columns
((ivy-rich-candidate (:width 20))
(ivy-rich-switch-buffer-size (:width 7 :align right))
(ivy-rich-switch-buffer-indicators
(:width 2 :face error :align right))
(ivy-rich-switch-buffer-major-mode (:width 12 :face warning))
(ivy-rich-switch-buffer-project (:width 8 :face success))
(ivy-rich-switch-buffer-path
(:width (lambda (x)
(ivy-rich-switch-buffer-shorten-path
x (ivy-rich-minibuffer-width 0.3))))))
:predicate (lambda (cand) (get-buffer cand)))
counsel-M-x
(:columns
((counsel-M-x-transformer (:width 40))
(ivy-rich-counsel-function-docstring
(:face font-lock-doc-face))))
counsel-describe-function
(:columns
((counsel-describe-function-transformer (:width 40))
(ivy-rich-counsel-function-docstring
(:face font-lock-doc-face))))
counsel-describe-variable
(:columns
((counsel-describe-variable-transformer (:width 40))
(ivy-rich-counsel-variable-docstring
(:face font-lock-doc-face))))
counsel-recentf
(:columns
((ivy-rich-candidate (:width 0.8))
(ivy-rich-file-last-modified-time
(:face font-lock-comment-face))))))
(ivy-rich-mode 1))
;; (defun limited-counsel-locate-cmd (input)
;; "Return a shell command based on INPUT."
;; (counsel-require-program "locate")
;; (format "locate -l 10 -i --regex '%s'"
;; (counsel-unquote-regex-parens
;; (ivy--regex input))))
;; (defun bad ()
;; (interactive)
;; (let (process buffer)
;; (ivy-read "File: "
;; #'(lambda (input)
;; (append
;; '("Recent Files\n" . "")
;; (recentf-elements 10)
;; (directory-files default-directory "")
;; (mapcar (lambda (b) (buffer-name b)) (buffer-list))
;; (if (< (length input) 3) (counsel-more-chars 3)
;; ;; (counsel--async-command
;; ;; (funcall #'limited-counsel-locate-cmd input))
;; (when process (kill-process process))
;; (setq process (start-file-process-shell-command
;; "*locate*"
;; "*locate*"
;; (funcall #'limited-counsel-locate-cmd input))))
;; ))
;; :dynamic-collection t
;; :unwind #'(progn (kill-buffer))
;; :sort nil
;; :action #'(lambda (x)
;; (with-ivy-window
;; (if (file-exists-p x) (find-file x)
;; (switch-to-buffer x)))))))
;; '(helm-source-recentf
;; helm-source-file-cache
;; helm-source-files-in-current-dir
;; helm-source-buffers-list
;; helm-source-locate)
|