Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Once I saw people using Matlab use a keystroke shortcut that made all the same symbols as a selected symbol become blue. I am wondering is there is a function in Mathematica that is similar. If so, what's the keyboard convenient shortcut. (Of course, Ctrl+F can be made to do something a little similar, but that is not what I'm looking for.)

share|improve this question
5  
The IntelliJ plugin does this. –  Szabolcs May 24 at 2:15
    
@Szabolcs I guess the right question is to ask which text editor can perform this function. So, is IntelliJ plugin usually the text editor for MMA user? –  Lawerance May 24 at 17:42

1 Answer 1

up vote 5 down vote accepted

An editor can only do this if it has enough understanding of Mathematica code to be able to tell which symbols are localized to what scopes. This is far from trivial, so there aren't many tools that can do this.

To my knowledge the Mathematica Front End does not do this type of highlighting (even though it does know what symbols are local and indicates this using syntax highlighting). To conveniently use "Find" in a notebook, select a word, press Command-E to set it as the search term, then press Command-G to cycle through hits. (These shortcuts are for OS X, check the Edit menu on other systems.) This is just dumb text search and it doesn't know about symbols or localization.

Wolfram Workbench is a powerful IDE for Mathematica, and can do this, as well as general structural manipulations on Mathematica code. Select a symbol, right-click, and choose Find References.

There's a great Mathematica plugin for IntelliJ IDEA which also has sufficient understanding of Mathematica code to highlight multiple occurrences of the same symbol, taking into account localization. This is done automatically as you type. See how it underlines the symbol name:

enter image description here

Both Workbench and the IDEA plugin are meant for package development, and can only edit plain text files, but not notebooks. If you do interactive work, stick to the Front End. For developing packages that will be maintained for a while, these two IDEs are excellent.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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