[TxMt] Re: Colors in R.tmbundle

Hans-Jörg Bibiko bibiko at eva.mpg.de
Tue Jan 26 07:33:48 UTC 2010


On 25.01.2010, at 23:59, Paul Metzner wrote:
> I completely switched from the R Console to R.tmbundle in TextMate and am until now very satisfied with my decision. Nevertheless, I'd like to change the colors in the runtime from all the blues to something more subtle. Is thery any way to do this with environment variables? I didn't find anything in the documentation.

Hi Paul,

all colors/styles of characters in TM are managed via scopes which are assigned by a regexp defined in each bundle's language file like for R in R.tmlanguage:
...
{	name = 'constant.language.r'; match = '\b(T|F|TRUE|FALSE|NULL|NA|Inf|NaN)\b'; }, 
...
which mean assign the scope 'constant.language.r' to everything which is found for the match regexp.

How this scope will be drawn is defined in the color theme (TM Preference > Fonts&Colors).

To change I'd suggest that you duplicate your default theme (press the popup menu in TM Preference > Fonts&Colors > Edit Theme List) and name it e.g. R. Then go to a R doc, place your cursor in front of the character string whose color/style you want to change, and press ⇧^P (Bundle Development > Show Scope). 

E.g. you want to change the color for R constants, place your cursor in front of the string NULL and press ⇧^P, you'll see 'source.r' 'constant.language.r'.

Then go to your (new) theme in the Prefs and add a new style (+ button left from Scope Selector), enter a name, and set Scope Selector to 'constant.language.r'  (without the '), then you can change the color/style and you see your changes immediately in your R doc. 

That's it.

Hopefully it helps,

--Hans


More information about the textmate mailing list