MacOS – TextMate File Type Association Guide

file associationmacostextmate

I would like TextMate to recognize that RDF files are XML and highlight them as such but I can't seem to find a way to do this through the UI. Is there a way to add file extension/type associations?

Best Answer

In the menu, go to Bundles -> Bundle Editor -> Edit Languages -> XML -> XML. (That is, in the section XML, you have both XML and XSL.)

Then in the grammar you will see in the right pane, add RDF files to the fileTypes section. (That section is right at the top of the grammar in this case, but as @umassthrower points out, it may be later.):

    {   scopeName = 'text.xml';
        fileTypes = ( 'xml', 'tld', 'jsp', 'pt', 'cpt', 'dtml', 'rss', 'opml' );

See this link for more gory details on filetype associations.

Per @zengabor in a comment, “In TextMate 2 the steps are: Bundles > Edit Bundles... > XML > Language Grammars > XML, and then edit the list of "File Types" in the drawer.”

Related Question