Changing the color of specific words


#1

I’m completely new to atom, and I’m trying to figure out a way to make specific words different colors. I’m really only using this for a few of the files that I use in for Civil3D.

I’d like anything after an * to be recolored up until the first , and there would be different colors for different key words.
For example:

*FIRE,Fire ---- F ---- F ---- F ----

A,1.5,-.15,[“F”,TTF,S=.07,U=0.0,X=-.075,Y=-.025],-.075

" *FIRE, " just the word FIRE would be colored RED or something.

*STORM_DRAIN,Storm Drain ---- D ---- D ---- D ----
A,1.5,-.15,[“D”,TTF,S=.07,U=0.0,X=-.075,Y=-.025],-.075

" *STORM_DRAIN," just the words STORM_DRAIN would be colored green.

I just wanted to know if doing this is possible, and if so what steps would I need to take to accomplish this?


#2

It is technically possible to use markers and decorations to do this.

Alternatively, you can write a grammar that injects itself into whatever grammars you want that behaviour in. I don’t know what Civil3D is, but if there is an existing grammar for it (likely called language-civil3d or something), then I can help with that.

Once you have a grammar, you can target the scopes with your stylesheet.