* lisp/bandali-gnus.el: Some automatic processing for incoming spam
[~bandali/configs] / lisp / bandali-ivy.el
CommitLineData
4c05c418
AB
1;;; bandali-ivy.el --- bandali's Ivy setup -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2018-2020 Amin Bandali
4
5;; Author: Amin Bandali <bandali@gnu.org>
6;; Keywords: matching
7
8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; This program is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21;;; Commentary:
22
23;; My configuration for Ivy and family.
24
25;;; Code:
26
679463c6
AB
27(use-package ivy
28 :defer 0.3
29 :bind
30 (:map ivy-minibuffer-map
31 ([escape] . keyboard-escape-quit)
32 ([S-up] . ivy-previous-history-element)
33 ([S-down] . ivy-next-history-element)
34 ("DEL" . ivy-backward-delete-char))
35 :config
36 (setq ivy-wrap t
37 ;; ivy-height 14
38 ivy-use-virtual-buffers t
39 ivy-virtual-abbreviate 'abbreviate
40 ivy-count-format "%d/%d ")
41
42 (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode))
43 (defun b/ivy-ignore-buffer-p (str)
44 "Return non-nil if str names a buffer with a major mode
45derived from one of `b/ivy-ignore-buffer-modes'.
46
47This function is intended for use with `ivy-ignore-buffers'."
48 (let* ((buf (get-buffer str))
49 (mode (and buf (buffer-local-value 'major-mode buf))))
50 (and mode
51 (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes))))
52 (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p)
53
54 (ivy-mode 1)
55 :custom-face
56 (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee"))))
57 (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold))))
58 (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold))))
59 (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold))))
60 (ivy-current-match ((((class color) (background light))
61 :background "#d7d7d7" :foreground "black")
62 (((class color) (background dark))
63 :background "#65a7e2" :foreground "black"))))
64
65(use-package swiper
66 :demand
67 :after ivy
68 :bind (("C-S-s" . swiper-isearch)))
69
70(use-package counsel
71 :demand
72 :after ivy
73 :bind (("C-c f r" . counsel-recentf)
74 :map minibuffer-local-map
75 ("C-r" . counsel-minibuffer-history))
76 :config
77 (counsel-mode 1)
78 (defalias 'locate #'counsel-locate))
79
80(provide 'bandali-ivy)
4c05c418 81;;; bandali-ivy.el ends here