Several months ago, I made the switch from BBEdit to TextMate. I haven’t regretted that decision once. In fact, with each new update of TextMate, I become more confident I made the right decision.
I do quite a bit of work that involves ExpressionEngine, which has it’s own markup similar to XHTML. I wanted a way to easily differentiate between regular XHTML and EE markup. Thanks to the flexibility of TextMate, I was able to create a bundle that does just that, plus some.
You can see in the example to the right that all EE tags are highlighted for easy identification. It doesn’t highlight EE tags inside of quoted strings though, but that’s not a big deal.
Another feature you can see in the example is that I’ve included many snippets to make creating new templates much easier. In the example, I’ve typed in “entries” and hit the Tab key. Since there are three snippets that have that trigger, all three are listed and I can choose which one I want. I select the {exp:weblog:entries} tag and it adds in the basic structure that I need to get started. I can quickly tell it what weblog to use, what to disable and any other parameters thanks to how TextMate’s snippets allow for cursor placement. I’ve included over 50 snippets and plan to add some more soon.
Another really cool feature is shown below. You can select an EE tag and hit control-e to open up a small window showing the manual instructions for it. It will work on all standard tags that include “exp:” in them as well as a few others commonly used. It will not work with plugins since there’s no way I could easily keep up with all of them.
One that is set up a little different, and I use a fair amount is the time formatting entry. Instead of selecting the tag name, you select the “format” parameter and it will open up the manual to the time formatting instructions. I can never remember what the different options do, so this comes in quite handy.
Download the TextMate ExpressionEngine bundle.
April 30, 2006 - I’ve taken some time to polish up the bundle now. I’ve redone the entire language file in the bundle which makes for much better highlighting and code folding now. If you’d like to try it out, subscribe to the mailing list and look for a recent thread titled ‘ExpressionEngine bundle’. It’ll be attached to an email in the thread.
April 30, 2006 - I’ve now made it available for download on this site. If you use EE and TextMate, download the bundle and let me know what you think. Submit feature requests here too.
June 22, 2006 - I’ve uploaded a newer version of the bundle. No huge changes with this one, just a little organization in the bundle menu. If you’ve got some tags, templates or other features you’d like to see in the bundle, let me know.
Sept. 7, 2006 - The bundle has been updated to include EE comments, wiki tags, the improved embed tag, the simple commerce purchase tag and a few other additions. If you have anything else you’d like added to the bundle, or you’ve found a mistake, let me know.
June 6, 2007 - I’ve polished up a couple of the existing snippets, and added a few more that were missing. The biggest addition to this version is auto-completion of EE parameters. I believe I’ve got them all included. Let me know if I’ve missed anything.
Oct. 23, 2007 - Just a note to let Windoze users know that my bundle will work with e-Texteditor. You might get a lot of error messages when unzipping the file, but it should still work correctly.
I’ve become motivated to work on the bundle again. I took a look at how the Movable Type bundle was put together and redid their language file to work with EE tags. That means highlighting works like it did before, but there’s also code folding for the major EE tag pairs and conditionals.
If you want to try it out, subscribe to the TextMate mailing list. I recently attached it to an email in the list.
I’m really happy with the bundle now. It could use some more snippets, but I’m not sure what people really use and want. I’ve got most of the major tags in there. If you want some other ones, please let me know what they are.
Backspace, the tab triggers don’t include exp:. Doing so would mean a list of tags a mile long.
If you open the Bundle Editor window and look inside the EE bundle, you’ll notice that some of the tags have words in paranthesis. That would be their trigger. Most of the other major EE tags use the last word of the tag as their trigger.
For example:
[Tag] -> [Trigger]
exp:weblog:entries -> entries
exp:weblog:categories -> categories
You can also select the snippet and it’ll show you the trigger word, if it has one.
I’m a big EE fan, and an even bigger Textmate fan, so this is wonderful!
But just so I’m clear… so would one have to open a template in EE through the CP, copy, paste into Textmate, edit, then copy and paste back into the CP and hit update? Is there anyway to setup EE to read actual files instead of templates being database driven as well? I realize this is part of what makes EE so freaking special and powerful and flexible… but is anyone aware of a way to do this?
Yes, you can set up EE to read files via FTP. Read this.
I use Transmit as my FTP client. You can set TextMate up to be your default editor. If you also have EE setup to save templates as files, then all you need to do is select the file in Transmit you want to edit and choose “Edit in TextMate” in the contextual menu. It will open up the file in TextMate for you to edit. Once you’re done, just save the file and it will automatically be uploaded to the server.
In my opinion, there is no better way to work with EE templates.
Did you finish the bundle?