/evil-search-highlight-persist

Emacs minor mode to highlight search results in all the buffeer until you clear them or make another, like Vim hlsearch option.

Primary LanguageEmacs LispGNU General Public License v2.0GPL-2.0

Emacs Evil-Search-Highlight-Persist Minor Mode

http://melpa.milkbox.net/packages/evil-search-highlight-persist-badge.svg

This is a fork of the original, unmaintained, evil-search-highlight-persist.

This Emacs extension will make isearch and evil-ex-search-incremental (the “slash search”) to highlight the search term (taken as a regexp) in all the buffer and persistently until you make another search or clear the highlights with the search-highlight-persist-remove-all command (default binding to C-x SPC). This is how Vim search works by default when you enable hlsearch. This extension requires the “highlight” extension.

http://i.imgur.com/mwANxIA.png

Usage

To enable:

(require 'highlight)
(require 'evil-search-highlight-persist)
(global-evil-search-highlight-persist t)

To only highlight strings whose length is great than or equal to 3

(setq evil-search-highlight-string-min-len 3)

To change the default highlight face:

(set-face-background 'evil-ex-lazy-highlight "gold")
(set-face-foreground 'evil-ex-lazy-highlight "black")

To enable highlighting ( and un-highlighting ) across all windows, similiar to what Vim does:

(setq evil-search-highlight-persist-all-windows t)

Alternatives

This behavior is built-in to Evil if one if using the evil-search module:

(setq evil-search-module 'evil-search)

However, this is not available when using isearch, which I beleive provides a superior searching experience. This package also provides the benefit of being able to highlight all current windows, simliar to what Vim does.

In my opinion, this package would be made obsolete if evil-search was tweaked to behave more like isearch, and once evil supports highlighting across all windows.