emacshighlighting

How to highlight all occurrences of a word in an Emacs buffer?


Notepad++ has a convenient feature: if you select a word in your text (not necessarily a keyword), the word is highlighted throughout the text. Can this be done in Emacs as well? And if so, how?

It doesn't necessarily have to work exactly like Notepad++ (i.e., via selection); ideally, I would like to set up a key binding that causes all occurrences of the word under cursor to be highlighted.

It would be great if the highlights were permanent, i.e., moving point away from a highlighted word should not cause the highlight to be removed.

Also, it would be useful if there was a solution that made it possible to navigate between highlights (using custom key bindings).


Solution

  • Maybe highlight-symbol.el at http://nschum.de/src/emacs/highlight-symbol/ is what you are looking for:

    alt text