Add convenience C-c e p binding for pp-macroexpand-last-sexp
[~bandali/configs] / lisp / bandali-ivy.el
1 (use-package ivy
2 :defer 0.3
3 :bind
4 (:map ivy-minibuffer-map
5 ([escape] . keyboard-escape-quit)
6 ([S-up] . ivy-previous-history-element)
7 ([S-down] . ivy-next-history-element)
8 ("DEL" . ivy-backward-delete-char))
9 :config
10 (setq ivy-wrap t
11 ;; ivy-height 14
12 ivy-use-virtual-buffers t
13 ivy-virtual-abbreviate 'abbreviate
14 ivy-count-format "%d/%d ")
15
16 (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode))
17 (defun b/ivy-ignore-buffer-p (str)
18 "Return non-nil if str names a buffer with a major mode
19 derived from one of `b/ivy-ignore-buffer-modes'.
20
21 This function is intended for use with `ivy-ignore-buffers'."
22 (let* ((buf (get-buffer str))
23 (mode (and buf (buffer-local-value 'major-mode buf))))
24 (and mode
25 (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes))))
26 (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p)
27
28 (ivy-mode 1)
29 :custom-face
30 (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee"))))
31 (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold))))
32 (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold))))
33 (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold))))
34 (ivy-current-match ((((class color) (background light))
35 :background "#d7d7d7" :foreground "black")
36 (((class color) (background dark))
37 :background "#65a7e2" :foreground "black"))))
38
39 (use-package swiper
40 :demand
41 :after ivy
42 :bind (("C-S-s" . swiper-isearch)))
43
44 (use-package counsel
45 :demand
46 :after ivy
47 :bind (("C-c f r" . counsel-recentf)
48 :map minibuffer-local-map
49 ("C-r" . counsel-minibuffer-history))
50 :config
51 (counsel-mode 1)
52 (defalias 'locate #'counsel-locate))
53
54 (provide 'bandali-ivy)