[TxMt] refining scopes

Charilaos Skiadas cskiadas at uchicago.edu
Sun Feb 19 22:02:59 UTC 2006


Oliver,

	you'll want to look into named captures. For instance in the LaTeX  
bundle, we have the following:

		{	name = 'meta.verb.latex';
			match = '(\\verb[\*]?)(\S)(.*?)(\2|$)';
			captures =
			{	1 = { name = 'support.function.verb.latex'; };
				2 = { name = 'keyword.operator.delimiter.latex'; };
				3 = { name = 'markup.raw.verb.latex'; };
				4 = { name = 'keyword.operator.delimiter.latex'; };
			};
		},

So, what this does is, if you have: \verb|foo|

then the whole thing will be meta.verb.latex
while \verb will be support.function.verb.latex, the two |'s will be  
keyword.operator.delimiter.latex, while foo becomes  
markup.raw.verb.latex
In other words, groups appearing in your match expression are  
captured, and they can be given names. 0 is the whole expression, 1  
is the first group etc.

On Feb 19, 2006, at 3:46 PM, Oliver Taylor wrote:
>
> I guess the simple question is: how do you stack more than two (the  
> document and the element) scopes?
>
> In Markdown a link gets text.html.markdown,  
> markup.paragraph.markdown, markup.underline.link.markdown... how do  
> I do that?

Haris





More information about the textmate mailing list