Looking for Mac text editor that can do on-the-fly highlighting

I’ve been googling my brains out looking for a Mac text editor that can do one thing, but it’s looking like I’m the only person who’s ever wanted to do this. As my last hope, I thought I’d ask here and see if anyone knows of something I haven’t found.

What I want to be able to do: As I’m looking through a text document, I select a word (e.g. “cow”) and tell the editor “highlight every occurrence of this in blue.” So now all "cow"s in the file are blue. Now I select another word, say “horse”, and tell it “highlight every occurrence of this in red”, and now all "horse"s are red, and all "cow"s are still blue. Now I select “camel” and tell it it to highlight them in red. Etc. As many words in as many colors as I want, all highlighted as I tell the editor. I can also bring up the list of highlighted words and their colors so that I can edit it, change the colors, delete words, etc. That list is automatically saved and I can easily apply it to any other text file that I open.

On Windows, I had been using ConTEXT which came the closest that I’ve ever found to what I want. It let me define arbitrary lists of words and specify the highlight color, but it did require a restart for changes to take effect.

So far, on the Mac, the closest I’ve found is TextWrangler, but near as I can tell I can only define two sets of words (BBLMKeywordList and BBLMPredefinedNameList) in any given language module.

It might be possible to do that in Textmate using a combination of bundles and syntax highlighting. But not out of the box, and I couldn’t tell you exactly how.

I think Tex-Edit Plus might do it, but you’ll need to do some scripting.
It can easily search-and-replace text and specify a text color, and it can specify arbitrary highlight colors, but I think it will take a script to search-and-replace specifying a highlight color.

It’s free to try.

Wow.
Believe it or not, Apple’s Pages will do this. You can specify a style that includes highlighting, and then search and replace text, applying the style you want.

The logical answer to this question is Emacs - the question is not whether Emacs can do what you want (it can), but how to make Emacs carry out this operation (involves LISP).

There is a Mac OS X port.

And a highlight extension that at least starts you in the right direction.

Well, I figured that Emacs could be made to do what I want, but as a non-Emacs user, I was really hoping that something off-the-shelf already existed so that I wouldn’t have to climb up the Emacs/Lisp learning curve.

Ok, I hadn’t thought of that, and it does work. But it’s a pretty tedious process. What I want is a syntax-highlighting editor that gives me more than the two keyword groups that TextWrangler allows.

Try Tex-Edit. It’s amazingly full-featured, and very scriptable.

You might check out TextWranglerand, failing that, its big brother BBEdit. While I haven’t the time to 100% confirm it will do it, I’ll be surprised if it doesn’t.

ETA: already tried by OP :smack: Maybe BBEdit though?

Two well-known and elaborately featureful third-party text editors for Winders can do this: UltraEdit and TextPad. I have no idea if either of these is available in a Mac version. Check them out and see if you can find out.

ETA: Just took a peek at the UltraEdit home page. Yesssss! There’s a Mac version! This is the editor you need to take a look at! (Didn’t see any Mac version mentioned on the TextPad page.)

ETA-2: UltraEdit for the Mac page.