chrisruzin.net :: TextMate ExpressionEngine Bundle (April 5, 2006)

Skip to main content
Newer: April 2006 Top 10 Songs Older: 1-2-3-4-5-6

TextMate ExpressionEngine Bundle

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.

Example of my EE bundle for TextMateYou 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.

Example showing the EE manual entry for a selected tag

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.

Feb. 11, 2009 - Minor update. I’ve added some more parameters to the auto-completion list, and added the {wiki:categories_list} tag. I also added Dane Thomas’ EE comment preference to the bundle. Now you can easily wrap any code inside of an EE template in an EE comment ({!-- --}).

Kaoro's gravatar Kaoro United States June 5, 2006

I edit both in the same project window, think that may be my problem. When I do set the language for one of the files, all of them are set to that.

SKD's gravatar SKD United States June 26, 2006

Thanks for sharing this, Chris. This helped me decide to buy TextMate.

Jamie's gravatar Jamie United States October 31, 2006

Thanks for doing this. Something I have not yet understood with textmate is how its syntax coloring works. From your screenshots, it would seem that you have gotten it to correctly color a mix of languages within a single file (HTML/EE, in this case). If I set the bundle in the menu to Expression Engine, TM correctly colors only the EE tags, while HTML remains uncolored (white). Any hints?

Cheers,

Jamie

Chris's gravatar Chris United States October 31, 2006

I’m not quite following you. What do you mean “set the bundle in the menu”? Do you mean “set the language” in the pull-down menu at the bottom of a window? If so, and your HTML tags are still white, then go to the application preferences and select Fonts & Colors. Scroll down until you see “Tag Name”. If it doesn’t have a color assigned to it, then click on the foreground color box and choose a color you like. Save your preferences and you should be good to go.

Jamie's gravatar Jamie United States October 31, 2006

Hi Chris,

Wow, thanks for the rapid reply. I meant choose the language in the menu at the bottom, yes.

But the behavior is that all code is white, save for the EE tags, which are colored. It’s as though the EE bundle doesn’t apply any HTML syntax coloring at all. As you understand TM, do I have to set up syntax coloring prefs for every language to be used (HTML in this case) in every language bundle that might encounter it (EE, in this case)?

So php in css, javascript in HTML, etc? Sounds rather inefficient.

Thanks again,

Jamie

Chris's gravatar Chris United States October 31, 2006

No, you shouldn’t have to set up colors for every language. All colors for all languages are assigned in the application preferences under Font & Colors. A bundle can include other languages and scopes so that all the appropriate languages are colored correctly. The EE bundle should colorize HTML, CSS and JavaScript similar to the screenshots.

Colors are assigned by scope selectors, not language. So if you open your Fonts & Colors preferences and select “Tag name”, the scope selector should read “entity.name.tag”. Elements can have more than one scope selector too.

Jamie's gravatar Jamie United States October 31, 2006

Chris,

Thanks very much. I looked into what you suggested, and somehow, although I’ve never knowingly tinkered with scope selectors, apparently the one you mention was absent. Do bundles or does TM ever modify those settings?

A fresh reinstall of the app and the bundle, and recreation of my prefs/app support, etc., while no doubt overkill, seems to have reenabled multilanguage syntax coloring.

Much obliged,

Jamie

Chris's gravatar Chris United States October 31, 2006

Glad to hear you got it working. I’m not sure what could’ve altered the scope selector. Possibly a theme.

Andy White's gravatar Andy White Great Britain (UK) November 5, 2006

Sorry if this is really basic, but I’m a newbie to TextMate, and looking to cut a few corners, if possible, so I’m on the scrounge for some help…

Downloaded TextMate demo, installed Subversion, downloaded EE bundle for Textmate. Double cliked bundel. It appears in my bundle list, but none of its features seem to work for me. I have scoured the TextMate docs, and it implies that what I did is enough.

I figure I’ve missed a step or two somewhere – any ideas? All help very gratefullt received, because from what I can see in thi spost, this looks fantastic and I’d love to get it working.

3dsl Eugen's gravatar 3dsl Eugen Germany November 28, 2006

Thanks Chris, I hope that it will function with me.

Russ Lipton's gravatar Russ Lipton United States January 27, 2007

Terrific work. How can I get TextMate to see EE index.php files so they aren’t treated as php?

Clayton Farr's gravatar Clayton Farr United States February 10, 2007

Thanks for putting the work into this Chris! I look forward to using it.

Moly's gravatar Moly United States February 18, 2007

nice work indeed. smile

David Kypuros's gravatar David Kypuros United States March 30, 2007

After Textmate uses Transit’s cache, I have to hit Apple-R to refresh Transit to refresh my site. Is it just me?

Chris's gravatar Chris United States March 30, 2007

Not following you. You’ve opened a file in TextMate through Transmit. When you save that edited file, your Web site still shows the older version of the file?

David Kypuros's gravatar David Kypuros United States March 30, 2007

Let me back up. All of your steps worked just fine for me. When I open the actual Textmate project file, all the settings remain.

I did have a thought… Is the main advantage of using these steps just to get tabs, or can I edit in Textmate and have it auto upload to my site? I.e. Transmit click “edit”, Textmate (make some changes), back to Transmit and upload the file?

I was playing with textmate’s refresh functionality and I found by clicking “Apple – R” while in transmit, my current textmate file was uploaded by just edited Textmate file.

The heart of what I’m looking for is auto upload with tabs.

By the way thanks for your bundle. Wonderful contribution to the community!
Chris's gravatar Chris United States March 30, 2007

I think I understand what you’re asking. It’s possible to have EE save your templates as files in the system folder on your FTP server. If you set up TextMate as your default editor in Transmit, you can select a file, choose ‘Edit in TextMate’, make your changes and hit Apple – s to save the file. It will automatically save the changes to the FTP server. It’s also possible to set up what the default action should be for double-clicking a file in Transmit. You can set it to open in an external editor. Then all you need to do to edit a file in TextMate is doubleclick on it.

Once you’ve opened the remote file in TextMate, there’s no need to go back to Transmit unless you want to work on a different file. There’s your auto upload.

And if you use the “Remote Files” TextMate project, which you seem to already know about, you’ll have tabs. Does that answer your question?

Brian Mitchell's gravatar Brian Mitchell United States April 4, 2007

It looks to me that Textmate is only for the MAC, so am I correct that your product requires Textmate to operate and therefore is only for MAC users? Thanks!
-Brian

David Kypuros's gravatar David Kypuros United States April 4, 2007

Thanks Chris for your input. It’s just like you said, Apple-S does the trick !! Textmate, Transit, EE Bundle…I don’t think it gets much better than this. One ring to rule them all. haha.

It’s worth the time getting your web development environment just right.

ps, Brian- If you enjoy your pc environment, but like some mac tools, do what I do…Use Both. I run a IMac Duo Core and a program called Parallels to emulate PC. My XP has never run faster (Office/VPN/Printing etc) I switch back and forth (Alt-Tab) between Mac/PC all day.
-David

Chris's gravatar Chris United States April 4, 2007

Brian – yes, the bundle only works with TextMate, which only runs on the Mac.

David – glad to hear you got everything setup the way you wanted. That setup makes editing EE templates a cinch.

David Webb's gravatar David Webb Great Britain (UK) April 8, 2007

I’ve just downloaded e (http://www.e-texteditor.com/) which is a windows text-editor that can use bundles and installed your Expression Engine bundle. I’m not entirely sure if its installed correctly though. The Gallery, Email, Member and Other menu items don’t expand, ie they have no sub entries. And not all of the entries have what i can only assume are keyboard shortcuts. Everything after reverse related entries in the weblog menu is missing a shortcut.

Is this how it should be or am i missing something using it this way?

Thanks in advance for your time & help.

Chris's gravatar Chris United States April 8, 2007

Not every snippet has a shortcut, although you can add your own shortcuts to them if you want.

I don’t think the bundle is installed correctly for you. I downloaded and installed Cygwin and E-TextEditor along with my EE bundle and everything works fine including the Documentation for Tag command. All menu items expand correctly.

The only thing I noticed was it would reorder the little popup menu when you type ‘entries’ and hit tab.

David Webb's gravatar David Webb Great Britain (UK) April 8, 2007

Hi Chris.

Thanks for looking into this. I just downloaded the zip again and this time used 7zip to unzip it (last time i just used XPs in built) and its come up with a list of files that it can’t unzip.
exp:comment:entries.plist
exp:comment:form:plist
exp:comment:preview.plist
exp:email:contact_form (contact).plist
exp:email:tell_a_friend (friend).plist
exp:gallery:categories.plist
exp:gallery:category_list.plist
exp:gallery:category_name.plist
exp:gallery:comments.plist
exp:gallery:entries.plist
exp:gallery:next_entry.plist
and the list goes on and on. 7zip has issues with 28 files in the Snippets sub-folder.

Is this where my problems are coming from?

Chris's gravatar Chris United States April 8, 2007

I used WinRAR and also got a lot of errors. The problem is the name of the plist… it includes : in it. WinRAR renamed the plist files, replacing : with _ . I went ahead and installed the bundle anyway and it worked fine.

David Webb's gravatar David Webb Great Britain (UK) April 9, 2007

Hey Chris. I just used winrar and it corrected the errors and installed fine. I know get all the menus, however I get an error on the document tag
D:/Program Files/e/tmcmd:77:in `+': can't convert nil into String (TypeError) from D:/Program Files/e/tmcmd:77

I guess I need to get in touch with e’s developers.

Your name is mandatory
Your email address is mandatory
Your comment is mandatory Formatting:
_emphasis_
*strong*
-deleted text-
@code@
   What word do you see to the left?
The captcha is mandatory