Function: evil-search-word

evil-search-word is a byte-compiled function defined in evil-search.el.

Signature

(evil-search-word FORWARD UNBOUNDED SYMBOL)

Documentation

Search for word near point.

If FORWARD is nil, search backward, otherwise forward. If SYMBOL is non-nil then the functions searches for the symbol at point, otherwise for the word at point.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-search.el
(defun evil-search-word (forward unbounded symbol)
  "Search for word near point.
If FORWARD is nil, search backward, otherwise forward. If SYMBOL
is non-nil then the functions searches for the symbol at point,
otherwise for the word at point."
  (let ((string (car regexp-search-ring)))
    (setq isearch-forward forward)
    (cond
     ((and (memq last-command
                 '(evil-search-word-forward
                   evil-search-word-backward))
           (stringp string)
           (not (string= string "")))
      (evil-search string forward t))
     (t
      (setq string (evil-find-thing forward (if symbol 'symbol 'evil-word)))
      (cond
       ((null string)
        (user-error "No word under point"))
       (unbounded
        (setq string (regexp-quote string)))
       (t
        (setq string
              (format (if symbol "\\_<%s\\_>" "\\<%s\\>")
                      (regexp-quote string)))))
      (evil-push-search-history string forward)
      (evil-search string forward t)))))