As pointed out by paldepind, isearch-forward-symbol-at-point
(M-s., by default) is a close equivalent to * in Vim. This function is available starting in GNU Emacs 24.4; if your Emacs is different or older, read on for alternatives.
Usually I just do (M-b ...) C-s C-w ... C-s. That is:
- M-b to move to beginning of word(s) of interest
- C-s to start an I-Search
- C-w to yank the word(s) starting at point
- C-s to find the next match
- more C-s to find later matches
- RET to exit the I-search at the most recent match
- or a bunch of C-g to abort back to the original starting location
Here is a go at integrating it into I-Search (invoked via C-s and C-r; use C-h k C-s for info on isearch
).
(require "thingatpt")
(require "isearch")
(define-key isearch-mode-map (kbd "C-*")
(lambda ()
"Reset current isearch to a word-mode search of the word under point."
(interactive)
(setq isearch-word t
isearch-string ""
isearch-message "")
(isearch-yank-string (word-at-point))))
Integrating it into I-Search takes advantage of its word matching and case sensitivity settings (C-s M-c C-* would do a case-sensitive search on the word under point).