* lisp/bandali-erc.el: add pals, show erc-track message counts
[~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
c9cc2425
AB
42 (defvar b/ivy-ignore-buffer-modes
43 '(;; dired-mode
44 ;; magit-mode
45 erc-mode))
679463c6
AB
46 (defun b/ivy-ignore-buffer-p (str)
47 "Return non-nil if str names a buffer with a major mode
48derived from one of `b/ivy-ignore-buffer-modes'.
49
50This function is intended for use with `ivy-ignore-buffers'."
51 (let* ((buf (get-buffer str))
52 (mode (and buf (buffer-local-value 'major-mode buf))))
53 (and mode
54 (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes))))
55 (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p)
56
9c48decc 57 (ivy-mode 1))
679463c6
AB
58
59(use-package swiper
60 :demand
61 :after ivy
62 :bind (("C-S-s" . swiper-isearch)))
63
64(use-package counsel
65 :demand
66 :after ivy
67 :bind (("C-c f r" . counsel-recentf)
68 :map minibuffer-local-map
69 ("C-r" . counsel-minibuffer-history))
70 :config
71 (counsel-mode 1)
72 (defalias 'locate #'counsel-locate))
73
74(provide 'bandali-ivy)
4c05c418 75;;; bandali-ivy.el ends here