Eclipse highlighting the same occurrence of the word [closed]

纵然是瞬间 提交于 2019-11-27 11:26:03

问题


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) .

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).


回答1:


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... :)




回答2:


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

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




回答3:


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




回答4:


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'.




回答5:


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




回答6:


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




回答7:


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




回答8:


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




回答9:


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




回答10:


Window > Preferences > Java > Editor > Mark Occurrences



来源:https://stackoverflow.com/questions/7238349/eclipse-highlighting-the-same-occurrence-of-the-word

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!