Function: evil-search-yank-word

evil-search-yank-word is an interactive and byte-compiled function defined in evil-search.el.

Signature

(evil-search-yank-word)

Documentation

Pull next word from buffer into search string.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-search.el
(defun evil-search-yank-word ()
  "Pull next word from buffer into search string."
  (interactive)
  (let ((minibuf-content (minibuffer-contents-no-properties))
        (word "") start)
    (with-current-buffer evil-ex-original-buffer
      ;; Start to initial point if C-w have never been hit.
      (unless evil-ex-search-yank-point
        (if (string= "" minibuf-content)
            (setq evil-ex-search-yank-point evil-ex-search-start-point)
          (setq evil-ex-search-yank-point (point))))
      (save-excursion
        (goto-char evil-ex-search-yank-point)
        (setq start (point))
        (when (looking-at-p (regexp-quote minibuf-content))
          (forward-char (length minibuf-content))
          (setq start (point))
          (forward-word))
        (setq word (buffer-substring-no-properties start (point)))))
    (and (eq evil-ex-search-case 'smart)
         (let (case-fold-search)
           (not (string-match-p "[A-Z]" minibuf-content)))
         (setq word (downcase word)))
    (insert word)))