<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 9, 2007, at 6:47 AM, Bob Ueland wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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 <br><br><div style="margin-left: 40px;">Class: ${1:ClassName}<br>SubClassOf: ${2:Object}<br>InstanceVariables: ${3:varName1},${4:varName2}<br></div><br>After I've entered the needed info (Rectangle, width and height) it looks like this <br><br><div style="margin-left: 40px;">ClassName: Rectangle<br>SubClassOf: Object<br>InstanceVariables: width,height<br></div><br>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) <br><br></blockquote>...<br><blockquote type="cite">Is there a way to do this?<br><br>Thanks Bob<br></blockquote></div><div><br class="webkit-block-placeholder"></div><div>Yes. There are a few ways you could do this.</div><div>You could write some sort of ruby script to parse the text you just entered and generate the code.</div><div>Then bind that command to some sort of keystroke or tab completion.</div><div><br class="webkit-block-placeholder"></div><div>Or you could write a really complex snippet using multiple instances of the same variable.</div><div>You can even have some of the instances of the variable use regex replacement to change the capitalization and let you insert an arbitrary number of objective-c instance variables with the corresponding code.</div><div><br class="webkit-block-placeholder"></div><div>Check the help docs for the syntax. Check out the objective-c bundle for examples.</div><div><br></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="font-size: 10px; "><span class="Apple-tab-span" style="white-space: pre; "> </span>thomas Aylott — </span><span class="Apple-style-span" style="font-size: 10px; "><b style="font-weight: bold; ">subtleGradient </b></span><span class="Apple-style-span" style="font-size: 10px; ">— </span><span class="Apple-style-span" style="font-size: 10px; ">CrazyEgg — bundleForge</span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div></div></div></body></html>