Eclipse highlighting the same occurrence of the word

EclipseEclipse PluginSyntax Highlighting

Eclipse Problem Overview


In Notepad++ , it has a very nice feature that if I select a word , it will highlight all the same words throughout the text . Added to this , I can set the hot-keys to highlight up to five different words with different styles (See the effect below) .

enter image description here

Is there any ways /plug-ins to get this similar effect in eclipse ? I know when editing Java , it will highlight all the same variables ,but it will not work when I highlight the comments and editing other files type (e.g. xml, html, js, css and etc).

Eclipse Solutions


Solution 1 - Eclipse

I've been working with Eclipse for quite a while and I'm pretty certain that there is no canonical way of doing this.

In Eclipse these things are managed on a per-editor basis and the Java editor does not support what your looking for for all I know. At least for the Java editor you can do some minor configuration in what is highlighted and how (Preferences > Java > Editor > Mark Occurrences), but I guess you already know that.

As for plugins, I'm not aware of any plugin that achieves what you're looking for. As a matter of fact I'd be surprised if there really was a plugin which achieves what you're looking for.

If something comes up I'd much appreciate you sharing it here, I've been trying to get decent highlighting into Eclipse for years unsuccessfully... :)

Solution 2 - Eclipse

Here is a plugin for eclipse: http://ystrot.github.io/glance/

It highlights all occurrences as with notepad++ upon hitting Ctrl + Alt + F.

Solution 3 - Eclipse

If you enable "Mark Occurrences" , then all words that are the same as the one you have marked will be highlighted.

You can enable it in two following ways

  1. Alt + Shift + O

  2. Preferences > Java > Editor > Mark Occurrences

    enter image description here

Solution 4 - Eclipse

Below is what I found works for me but you can also assign a key shortcut to 'Find Text in File':

  1. Select the word or section of text
  2. Press CTR+3 to activate 'Quick Access' search
  3. Type 'Find Text in File'
  4. Execute

As mentioned by @Kislingk you can modify how the words are highlighted/marked in 'Preferences > General >Editors>Text Editors > Annotations'.

eclipse-highlight-search-results-in-file

Solution 5 - Eclipse

Here is the closest solution I have found:

  1. Create a shortcut in Preferences/General/Keys type in the search field: "Find Text in File" By default it has nothing assigned so just assign your key binding to it.

  2. Annotations can help with displaying it in the sidebar

enter image description here

Solution 6 - Eclipse

Use file search to search selected resource can highlight same word in single file.

Solution 7 - Eclipse

Another useful eclipse plugin is eclipse instasearch. It has extensive feature set. This is also available in eclipse marketplace.

Solution 8 - Eclipse

There are other options needed to enable.(Preferences > General >Editors>Text Editors > Annotations). Find Occurrences and WriteOccurrences and enable Text as 'Hightlight'

Solution 9 - Eclipse

Have tried all of the above answer, but all not working. At the end, i found that it's due to i have accidentally remove some of the JRE System Library, after add back, it's work correctly

Solution 10 - Eclipse

Window > Preferences > Java > Editor > Mark Occurrences

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKen ChanView Question on Stackoverflow
Solution 1 - EclipsefgysinView Answer on Stackoverflow
Solution 2 - EclipsewinxtonView Answer on Stackoverflow
Solution 3 - EclipseSumit SinghView Answer on Stackoverflow
Solution 4 - EclipseDaniel SokolowskiView Answer on Stackoverflow
Solution 5 - EclipseRooView Answer on Stackoverflow
Solution 6 - EclipsewangfView Answer on Stackoverflow
Solution 7 - EclipseSairam KrishView Answer on Stackoverflow
Solution 8 - EclipseKislingkView Answer on Stackoverflow
Solution 9 - EclipsewendyView Answer on Stackoverflow
Solution 10 - EclipseankitView Answer on Stackoverflow