Skip to content

Instantly share code, notes, and snippets.

@elliot
Created March 4, 2011 13:30
Show Gist options
  • Save elliot/854614 to your computer and use it in GitHub Desktop.
Save elliot/854614 to your computer and use it in GitHub Desktop.
Setting up TextMate for Twig syntax highlighting

Twig and Jinja share a common syntax, so to get syntax highlighting going in TextMate we are going to borrow one of the bundles already made for it.

Open up terminal and run the following:

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone http://github.com/ozan/textmate-jinja-templates.git "Jinja Templates.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'

Next, jump into TextMate Bundle Editor (Ctrl+Opt+Cmd+B) and go to the Jinja Templates bundle, open the "HTML (Jinja Templates)" language and change the following line from

fileTypes = (  );

... to ...

fileTypes = ( '.twig' );

... and now you will automatically get syntax highlighting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment