[TxMt] Dynamic snippets?

Bob Ueland cocoabob at gmail.com
Thu Aug 9 10:47:02 UTC 2007

I'm new to TextMate and thinking of using it for teaching purposes. I would
like to fill out a form and have TextMate to automatically create the needed
file. For instance I have a snippet called csc (short for
CreateStandardClass) that looks like this

Class: ${1:ClassName}
SubClassOf: ${2:Object}
InstanceVariables: ${3:varName1},${4:varName2}

After I've entered the needed info (Rectangle, width and height) it looks
like this

ClassName: Rectangle
SubClassOf: Object
InstanceVariables: width,height

After entering height and pressing tab I would like TextMate to generate the
Objective-C code below. (It should be possible since all needed data is in
the variables $1, $2, $3 and $4)

// Rectangle.h
#import <objc/Object.h>
@interface  Rectangle: Object
    int    width;
    int    height;
-(void)    setWidth:(int) w;
-(void)    setHeight:(int) h;
-(int)    width;
-(int)    height;

// Rectangle.m
#import "Rectangle.h"

@implementation Rectangle;
-(void)    setWidth:(int) w
-(void)    setHeight:(int) h
-(int)    width
    return width;
-(int)    height
    return height;

Is there a way to do this?

Thanks Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070809/a77ad8a1/attachment.html>

More information about the textmate mailing list