Suppose your code looks like this:

1. term_cursor_is_on = 500
2. cursory_next_line = 42
101. next_instance_line = term_cursor_is_on

And suppose that your cursor is on line 1 (unimportant, but suppose it is between 'c' and 'u') and you want to jump to the next instance of "term_cursor_is_on" on line 101.

Naively, you can do an I-search for "term_cursor_is_on" and press ctrl+s.

But this seems inefficient, since it requires you to type the currently-hovered-over term into I-search. Is there a better way to jump to the next instance of the term? Either a package, or some shortcut to auto-paste the hovered-over-term into I-search?

3 Answers 3


I think what you're looking for is isearch-forward-symbol-at-point which is bound to M-s .

Here's its documentation:


Do incremental search forward for a symbol found near point. Like ordinary incremental search except that the symbol found at point is added to the search string initially as a regexp surrounded by symbol boundary constructs _< and _>. See the command ‘isearch-forward-symbol’ for more information.

  • That's exactly what I was looking for. Thanks! Dec 4, 2019 at 21:30

Alternatively, you can use C-s C-w to search for some text the cursor is on.


I use and recommend package highlight-symbol. It not only does what you want, but highlights every occurrence of the term you want. One command highlights all the matches, another cycles through them forwards, another backwards. Not only that, but it highlights each term you search for in a different color, and the colors persist until you close or revert (reload) the buffer.

It also gives you the command highlight-symbol-query-replace, which lets you do a search-and-replace for the symbol at point ("point" is the Emacs vocabulary for what you're referring to as "the cursor") with every target pre-highlighted. This is the easiest way I've found so far for this very common programming requirement.

I have the commands all bound to F4 with and without various modifiers: F4, C-F4, M-F4, S-F4, C-M-F4, etc. I love it!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.