Emacs: Search Current Word π
Command to Search Current Word
Here's a command to isearch the word under cursor.
(defun xah-search-current-word () "Call `isearch' on current word or selection. βwordβ here is A to Z, a to z, and hyphen [-] and lowline [_], independent of syntax table. URL `http://xahlee.info/emacs/emacs/emacs_search_current_word.html' Created: 2010-05-29 Version: 2025-09-15" (interactive) (let (xbeg xend) (if (region-active-p) (setq xbeg (region-beginning) xend (region-end)) (save-excursion (skip-chars-backward "-_A-Za-z0-9") (setq xbeg (point)) (right-char) (skip-chars-forward "-_A-Za-z0-9") (setq xend (point)))) (deactivate-mark) (when (< xbeg (point)) (goto-char xbeg)) (isearch-mode t) (isearch-yank-string (buffer-substring-no-properties xbeg xend))))
You need to give it a easy key. Such as F8. γsee Emacs Keys: Define Keyγ
Also, you should set your isearch repeat to arrow keys. Emacs Init: isearch by Arrow Keys.
Emacs Find Replace
- Emacs: Search Text
- Emacs: Find Replace
- Emacs: Find Replace, by Regex
- Emacs: Find Replace and Change Letter Case
- Emacs: Highlight Word, Line
- Emacs: List Matching Lines
- Emacs: Search Text in Directory
- Emacs: Find Replace Text in Directory
- Emacs: Regular Expression
- Emacs Init: isearch Whitespace Regex
- Emacs Init: isearch by Arrow Keys
- Emacs Flaw: isearch Current Word
- Emacs: Search Current Word π
- Emacs: Xah Find Replace (xah-find.el) π¦