[TxMt] Re: Tab guides / lines

Gerd Knops gerti-textmate at bitart.com
Wed Dec 10 18:35:24 UTC 2008


On Dec 10, 2008, at 12:22 PM, Louis Walch wrote:

> Not exactly the same, but might work.
> How did you do this Gerd?
>
Well, it's sort of ugly, because you basically have to wrap your own  
language definition around all languages to support this, and then use  
that language. That wrapper defines 'meta.odd-tab' and 'meta.even- 
tab'. Then it is just a matter of setting the background color for  
these in the style.

An example for Objective-C is attached below.

Gerd

{	scopeName = 'source.objc.gerd';
	fileTypes = ( 'm', 'h' );
	foldingStartMarker = '(?x)
		 /\*\*(?!\*)
		|^(?![^{]*?//|[^{]*?/\*(?!.*?\*/.*?\{)).*?\{\s*($|//|/\*(?!.*?\*/.* 
\S))
	';
	foldingStopMarker = '(?<!\*)\*\*/|^\s*\}|^@end\b';
	patterns = (
		{	name = 'meta.leading-tabs';
			begin = '^(?=(\t| {4}))';
			end = '(?=[^\t\s])';
			patterns = (
				{	match = '(\t| {4})(\t| {4})?';
					captures = {
						1 = { name = 'meta.odd-tab'; };
						2 = { name = 'meta.even-tab'; };
					};
				},
			);
		},
		{	include = 'source.objc'; },
	);
}




More information about the textmate mailing list