Text Editor that hilights all instances of selection for Mac

Sublime Text is able to do that.


Who said BBEdit couldn't do it?

With your document in the front window:

  • Choose Search > Live Search ⌥ ⌘ F
  • Enter your search string
  • Notice that all instances of that string are now highlighted in your document

To make Live Search go away, click the Done button.

Reference: BBEdit 9.5 User Manual, pages 159-160


In addition to @Tim's answer, but also with input from this message on TextMate's mailing list , one can create the following one-key shortcut:

(
    {   command = 'selectWord:'; },
    {   command = 'copySelectionToFindPboard:'; },
    {   command = 'findAllInSelection:'; },
)

I assigned this to Command-A, and it works quite nicely, highlighting all occurrences of the word under cursor, whether pre-selected or not.

Caveats: this action will scroll the file to the last occurrence of the highlighted word, so one has to manually scroll back. In addition, this will trigger automatic substitution of all occurrences with the typed text ("parallel edit"), which is convenient in many cases but one has to be careful if this is unintended.


Earlier versions of BBEdit may not have been able to do this, but as of version 11, this is possible via:

Preferences -> Editing -> Highlight instances of selected text

Do note that the "free version" of BBEdit, called "TextWrangler", doesn't have this feature (it seems to be one of a number of items reserved for TextWrangler's big brother to sweeten the pot for upgraders).