[TxMt] Re: Templates

Allan Odgaard mailinglist at textmate.org
Fri Mar 7 11:34:08 UTC 2014


On 7 Mar 2014, at 14:10, Ross Ahmed wrote:

> Is the "New from template² feature still working in TextMate2? If yes 
> how
> can I create a template?

It is not, for now there are a few ways to get some of the benefits:

To get the boilerplate: Setup a default file type via the project’s 
.tm_properties, e.g. for TextMate itself I have this:

	[ attr.untitled ]
	fileType = 'source.objc++'

You can also set it globally in Preferences → Files → New document 
type.

Thus when pressing ⌥⌘N (New Tab) it will be set to Objective-C++ and 
one can for example use cl⇥ to insert the “new class” snippet.

Incase we want to split it into two files, pressing ⌘S (Save) and 
giving it a name like “Foo.{mm,h}” does brace expansion, so the 
current document is saved as “Foo.mm” and a new tab is opened for 
“Foo.h”.

Some people liked templates just to start with a file on disk, in which 
case one can use ⇧⌘N. This creates a new file on disk and brings 
focus to the file browser where one can then (re)name the new file.


More information about the textmate mailing list