[TxMt] Re: Change (adapt) syntax-highlighting

Allan Odgaard mailinglist at textmate.org
Fri Jan 10 03:15:09 UTC 2014


On 7 Jan 2014, at 23:33, Ingo Lantschner wrote:

> what is the best form, to change/adapt the highlighting of ons own 
> often-used functions?
>
> E.g. if I have a Perl sub called `i` (printing some debug-info to 
> stdout) and to be used e.g.
>
> 	 i 'Starting ifgrp store ...';
>
> And if would like to have these lines formatted like a comment (grey, 
> italics) so that it survives changes in the Perl-Bundle including 
> reinstallations of TM2. Where and how would someone define that?
>
> My guess is, to place it in my own Bundle and to use something like
>
> 	 		begin = '^\s*';
> 			end   = ';\s*$'; # trailing white space may occure
>
> But I can't figure out the details.

In your own bundle create a new grammar, I did the following (for 
testing):

    {  patterns = (
          {  name = 'comment.line.debug.perl';
             match = "\bi '.*';";
          },
       );
    }

Then in the side bar set “Injection Selector” to “source.perl”.

This will inject the above rule into the Perl grammar.


More information about the textmate mailing list