├── .gitignore ├── Cask ├── Changes ├── README.md ├── evil-anzu.el └── image └── evil-anzu.gif /.gitignore: -------------------------------------------------------------------------------- 1 | /.cask/ 2 | *.elc 3 | -------------------------------------------------------------------------------- /Cask: -------------------------------------------------------------------------------- 1 | (source melpa) 2 | 3 | (package-file "evil-anzu.el") 4 | (depends-on "anzu") 5 | (depends-on "evil") 6 | -------------------------------------------------------------------------------- /Changes: -------------------------------------------------------------------------------- 1 | Revision history for evil-anzu.el 2 | 3 | Revision 0.03 2015/01/25 fbergroth 4 | - Support evil-search search module (GordonGustafson) 5 | 6 | Revision 0.02 2015/01/22 syohex 7 | - Implement more simply 8 | - Support all search commands 9 | 10 | Thanks fbergroth 11 | 12 | Revision 0.01 2015/01/20 syohex 13 | - Initial release 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # evil-anzu [![melpa badge][melpa-badge]][melpa-link] [![melpa stable badge][melpa-stable-badge]][melpa-stable-link] 2 | 3 | [anzu](https://github.com/syohex/emacs-anzu) for [evil-mode](https://github.com/emacs-evil/evil) 4 | 5 | 6 | ## Screencast 7 | 8 | ![Screencast of evil-anzu](image/evil-anzu.gif) 9 | 10 | ## Installation 11 | 12 | You can install evil-anzu.el from [MELPA](https://melpa.org) with package.el. 13 | 14 | ## Configuration 15 | 16 | You can use `evil-anzu.el` only loading. 17 | 18 | ```lisp 19 | ;; Emacs 24.4 or higher 20 | (with-eval-after-load 'evil 21 | (require 'evil-anzu)) 22 | 23 | ;; Emacs <= 24.3 24 | (eval-after-load 'evil 25 | '(progn 26 | (require 'evil-anzu))) 27 | ``` 28 | 29 | [melpa-link]: https://melpa.org/#/evil-anzu 30 | [melpa-stable-link]: https://stable.melpa.org/#/evil-anzu 31 | [melpa-badge]: https://melpa.org/packages/evil-anzu-badge.svg 32 | [melpa-stable-badge]: https://stable.melpa.org/packages/evil-anzu-badge.svg 33 | -------------------------------------------------------------------------------- /evil-anzu.el: -------------------------------------------------------------------------------- 1 | ;;; evil-anzu.el --- anzu for evil-mode -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2017 by Syohei YOSHIDA 4 | 5 | ;; Author: Syohei YOSHIDA 6 | ;; Fredrik Bergroth 7 | ;; URL: https://github.com/syohex/emacs-evil-anzu 8 | ;; Version: 0.02 9 | ;; Package-Requires: ((evil "1.0.0") (anzu "0.46")) 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;;; Code: 27 | 28 | (require 'evil) 29 | (require 'anzu) 30 | 31 | (defun evil-anzu-start-search (string forward &optional regexp-p start) 32 | (when anzu-mode 33 | (anzu--cons-mode-line-search) 34 | (let ((isearch-regexp regexp-p)) 35 | (anzu--update string)))) 36 | 37 | (defun evil-anzu-search-next (&optional pattern direction nowrap) 38 | "Make anzu work with the \\='evil-search search module. 39 | If PATTERN is not specified the current global pattern 40 | `evil-ex-search-pattern' is used." 41 | (when anzu-mode 42 | (anzu--cons-mode-line-search) 43 | (let* ((isearch-regexp t) ; all evil-ex searches are regexp searches 44 | (current-pattern (or pattern evil-ex-search-pattern)) 45 | (regexp (evil-ex-pattern-regex current-pattern))) 46 | (save-match-data ; don't let anzu's searching mess up evil 47 | (anzu--update regexp))))) 48 | 49 | (defun evil-anzu-prevent-flicker (&optional force) 50 | ;; Prevent flickering, only run if timer is not active 51 | (when anzu-mode 52 | (unless (memq evil-flash-timer timer-list) 53 | (anzu--reset-mode-line)))) 54 | 55 | (defun evil-anzu-reset (name) 56 | (when (and anzu-mode 57 | (eq name 'evil-ex-search)) 58 | (anzu--reset-mode-line))) 59 | 60 | (advice-add 'evil-search :after #'evil-anzu-start-search) 61 | (advice-add 'evil-ex-find-next :after #'evil-anzu-search-next) 62 | (advice-add 'evil-flash-hook :after #'evil-anzu-prevent-flicker) 63 | (advice-add 'evil-ex-delete-hl :after #'evil-anzu-reset) 64 | 65 | (defun evil-anzu-unload-function () 66 | "unload evil anzu" 67 | (advice-remove 'evil-search #'evil-anzu-start-search) 68 | (advice-remove 'evil-ex-find-next #'evil-anzu-search-next) 69 | (advice-remove 'evil-flash-hook #'evil-anzu-prevent-flicker) 70 | (advice-remove 'evil-ex-delete-hl #'evil-anzu-reset) 71 | nil) 72 | 73 | (provide 'evil-anzu) 74 | 75 | ;;; evil-anzu.el ends here 76 | -------------------------------------------------------------------------------- /image/evil-anzu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emacsorphanage/evil-anzu/7309650425797420944075c9c1556c7c1ff960b3/image/evil-anzu.gif --------------------------------------------------------------------------------