From bibiko@eva.mpg.de Wed Jan 14 12:39:07 2009 From: =?utf-8?q?Hans-J=C3=B6rg?= Bibiko To: textmate@lists.macromates.com Subject: [TxMt] Re: Using mate command with templates Date: Wed, 14 Jan 2009 13:39:01 +0100 Message-ID: In-Reply-To: <98A6E1C1-E8F0-4C32-AC9B-D483625632D0@uni-koeln.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5381715425657344603==" --===============5381715425657344603== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On 14.01.2009, at 12:43, Arne Eilermann wrote: > is there a possibility to create an new file from template using the > mate terminal command? Maybe try this: you have a template file saved as ~/Desktop/template.txt which is an HTML template Hello, I'm a \"template\" Date: `date` Name: ${1:Write here your name} then you can invoke that shell command in the Terminal: mate untitled.html;osascript -e "tell app \"TextMate\" to insert \"`cat ~/Desktop/template.txt`\" as snippet true" Short explanation: - in the template file everything between `` backticks is evaluate on run-time - ${x:foo} notation indicates to insert foo as snippet - double quotes " must be escaped in the template file by \ - Unicode (UTF-8) safe since Leopard --Hans --===============5381715425657344603==--