Function: evil-ex-match
evil-ex-match is an interactive and byte-compiled function defined in
evil-commands.el.
Signature
(evil-ex-match ARGS &optional BANG)
Documentation
Define a pattern to highlight in the current buffer.
With no args, clear a highlight from the buffer
With only an ! argument, clear all highlights from the buffer.
With one arg, interpret as the pattern, and prompt for a face.
With two args, interpret as :match {face} /{pattern}/.
Unlike Vim, multiple highlights can be set at once, so there is no need for
":2match" and ":3match" Ex commands.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-command evil-ex-match (args &optional bang)
"Define a pattern to highlight in the current buffer.
With no args, clear a highlight from the buffer
With only an ! argument, clear all highlights from the buffer.
With one arg, interpret as the pattern, and prompt for a face.
With two args, interpret as :match {face} /{pattern}/.
Unlike Vim, multiple highlights can be set at once, so there is no need for
\":2match\" and \":3match\" Ex commands."
(interactive "<a><!>")
(unless args (setq args ""))
(string-match "\\` *\\([^ ]+\\)? *\\(.+\\)?\\'" args)
(let* ((face (match-string 1 args))
(search-string (match-string 2 args))
(raw-patterns (evil-delimited-arguments (or search-string face "")))
(raw-pattern (or (car raw-patterns) ""))
(case-fold-search ; ignore case if non-nil
(eq (evil-ex-regex-case raw-pattern evil-ex-search-case) 'insensitive))
search-upper-case ; bypass isearch-no-upper-case-p
(pattern-no-case (evil-ex-regex-without-case raw-pattern))
(pattern (if evil-ex-search-vim-style-regexp
(evil-transform-vim-style-regexp pattern-no-case)
pattern-no-case)))
(cond
((or (not face) (string= "none" face))
(if bang
(hi-lock-unface-buffer t)
(call-interactively #'hi-lock-unface-buffer)))
((/= 1 (length raw-patterns))
(user-error "Invalid pattern argument"))
((not search-string)
(require 'hi-lock)
(hi-lock-face-buffer pattern (hi-lock-read-face-name)))
(t (hi-lock-face-buffer pattern face)))))