It’s Text, Mate!

by Matt Mecham on November 25, 2005

in Uncategorized

Rikki has been chipping away at me for months now about a relatively new OS X text editor called “TextMate“.

I’m a long time BBEdit user. I’ve used it ever since version 5 and I’ve never coded anything in any other text editor – so it was always going to be an uphill struggle to get me to switch. BBEdit is comfortable and feels totally natural. I don’t have to think about the interface, my mouse finds its own way around.

Rikki was selling me on many of TextMate‘s features, including the “snippets” editor. This allows you to define “snippets” of text that are activated either via a hot key or via a keyword followed by a tab. TextMate comes with hundreds of pre-defined snippets, many for PHP. Not only can you define snippets of text, you can also use TextMate’s tagging system to allow you to tab through the result to change data.

For example:
You type: “array” then hit tab. It adds “$arrayName = array( ‘var’, );” to the document with ‘arrayName’ highlighted. You type in your desired variable name, hit tab and it moves to “var”, change that and hit tab and it moves to the comma, allowing you to delete it or to add more elements to the array.

I finally got around to trying out TextMate today and I’m sold. I’ve purchased a license and retired BBEdit. There are so many time-saving features: from the project display which allows you to list all your project files as a drawer (a common feature to IDEs but lacking in BBEdit) to being able to create your own snippets (I have created one where you type “ips” and hit tab and it adds “$this->ipsclass->” into the document and a few for comments, functions, etc). You can also create commands which can run bash / perl scripts. I have one that takes the highlighted text and runs it as a query on my test IP.D database.

It’s also very, very quick unlike most IDEs I’ve tried. There is no lag when typing and apart from a few seconds for the syntax colouring to kick in when loading a new document (you are free to edit and move around the document while it thinks about the colours, it doesn’t lock up the computer) everthing is instant.

I took a quick movie capture of it in use. Notice how the mouse doesn’t move until I double click on ‘require’ to show off the “Get Document for Word” feature (I set that to F3). The function block illustrates the ability to tab through the snippet elements. Sorry about the dodgy quality and the dark gray banding across the first fifth of the window.

If you’ve got OS X, go buy it now. If you’ve not got OS X, buy a Mac first. It’s almost a killer app. ( 2.5mb Quicktime .mov(ie) )


1 Rikki November 25, 2005 at 4:07 pm

It took me a while, but I got there in the end ;) It really does speed up coding, and allows you to do pretty much whatever you want in your code. You can write commands to do anything using any language that you can access via Shell. You can launch apps using shell commands. You can run text from any document through PHP using shell. You can even run applescript through shell to do whatever you need.

Right now I can type a query in any document I have open, select it, hit F4 and it pops up a window with the results of the query. You can do all your SVN checking in and out and updates via hotkeys. It’s so customizable it’s untrue.

(Can you see what Matt’s had to put up with for the past couple of months now?)

2 Matt November 25, 2005 at 4:12 pm


Rikki is like the TextMate cheerleader.

3 Rikki November 25, 2005 at 4:19 pm

2, 4, Text, Mate, who do we appreciate?!

4 Tim Dorr November 25, 2005 at 4:22 pm

Cool, I’ve been trying out TM for a little while too. I still switch between it and BBEdit from time-to-time, but I’m starting to like TM more. What you need to do is start using expandable snippets for your comments. I noticed in your video you had to separately type in your comments. Well, try popping in this snippet:

// ${1:${TM_SELECTED_TEXT:Comment}}

I linked that to “com” and tab under the Source group in the snippet editor. So, I type com, hit tab, and type in my comment. The top and bottom dash lines will automatically expand to fit the text I type. It’s cool stuff.

5 Matt November 25, 2005 at 4:36 pm

Now that is cool.

6 Matt November 25, 2005 at 4:41 pm

I have it set up so it kind of looks like BBEdit when editing, which gives me warm fuzzies.

7 Tim Dorr November 25, 2005 at 5:24 pm

Oh yeah, another little useful thing is TmCodeBrowser:

8 Rikki November 25, 2005 at 6:13 pm

It’s not a great acheivement particularly, but it’s useful – I’ve got phpMyAdmin to open in a TextMate window so that it’s really easy to manage the database while coding. The command to add is:

exit_show_html “”

9 Rikki November 25, 2005 at 6:14 pm

OK that didn’t work too well. Another try:

exit_show_html “”

10 Rikki November 25, 2005 at 6:32 pm

Ah screw it :p

11 Matt November 25, 2005 at 7:36 pm

HTML stripping is a pain. :/

12 Tim Dorr November 25, 2005 at 8:33 pm

Regular strippers are quite fun, though :P

13 phatmonkey November 25, 2005 at 8:35 pm

Wowee, very nice. I’ll try it out now!

14 Michael November 26, 2005 at 2:22 pm

I’m been having a really hard time finding a suitable editor for Windows. I’d switch to a Mac, weren’t it for the fact that I have no cash.

15 Peter November 26, 2005 at 4:56 pm

Same here Michael :p

I currently use Notepad2, all the other editors suck, they come bloated with 100′s of features that you will most likely never use.

16 Don Wilson November 26, 2005 at 11:29 pm

Michael, for Windows, I think Crimson Editor is the best as it’s light weight, has a great coloring agent and allows for projects.

17 Bob November 27, 2005 at 2:08 am

I might give textmate a try on my mac, i just don’t like bbedit.

For windows, i use editplus. It’s not got any of the fancy features of auto complete though, but the colour highlighting works well and it’s really easy to use.

18 Kennedy November 27, 2005 at 9:35 am

Editplus is really good.

19 David November 27, 2005 at 8:28 pm

I thinking about getting a Mac when I go to colledge, maybe I’ll try out that program. For now I’m good with Dreamweaver 8. Sounds cool, nice cheerleading Rikki.

20 rollercoaster375 November 28, 2005 at 1:57 am

Code folding? I’m sold. But I must say, SubEthaEdit deserves a mention on OS X. *Runs off to download TextMate*

21 Sam Granger November 29, 2005 at 9:57 am

I have just found a coder that can make an application for me identical to TextMate, but for windows. :D

22 Matt November 29, 2005 at 7:05 pm

Really? That’s quite impressive.

TextMate leans heavily on OS X’s UNIX underpinnings to run bash scripts, etc. It’ll be very clever to emulate that on a Win set up.

23 Rikki November 29, 2005 at 7:13 pm

Not to mention the fact I’m sure there will be patent issues, since a lot of TextMate is innovative and I’m sure protected…

I like the idea that you can just find someone that’s going to write you what is a very complex application just like that o_O

24 Josh November 30, 2005 at 2:32 am

Which features would you say are innovative? From what I’ve read and seen of TextMate, it dosn’t have anything that a lot of other editors have. Although I would have to say that is implemented those features in very slick ways, better than a lot of other implementations I’ve seen.

25 Don Wilson November 30, 2005 at 5:28 am

I wouldn’t see how the app has innovative features. The only thing that it could have that is unique is the drawer and the array->tab->[automatic]phpcode, but that seriously couldn’t be that hard to impliment.

If someone made a TextMate for Windows I would definately buy it, but not for the Mac; at least, not yet. From what I’ve seen, it wouldn’t be too hard at all to make an editor like that, depending on your knowledge of any given language.

26 Don Wilson November 30, 2005 at 5:39 am

If someone made a TextMate-like app for Windows I would definately buy it, or at least donate money to help out the cause.

27 Sam Granger November 30, 2005 at 11:34 am

Well, I have just told the guy he’s hired. Just waiting for his reply. :)

28 Don Wilson November 30, 2005 at 7:45 pm

How much is he asking for that project, if you don’t mind. Also, in what language?

29 Sam Granger December 1, 2005 at 2:25 pm

Only $100. Using Visual C++ and MFC.

30 Rikki December 1, 2005 at 3:26 pm

I guesstimate that’s about 5c an hour then o_O

31 Sam Granger December 1, 2005 at 8:01 pm

Well, very cheap yes. 3rd world country.

32 Don Wilson December 1, 2005 at 8:51 pm

I’m already starting to lose interest. >_<

33 TheBrain0110 December 1, 2005 at 9:20 pm

I use [URL=]WeBuilder[URL]. Does everything I need it to.

34 TheBrain0110 December 2, 2005 at 1:11 am

Ooops. I don’t suppose you can edit a comment can you?

35 Don Wilson December 2, 2005 at 3:41 am

We’re all smart here – we know how to extra a url from bbcode ;)

36 Paul December 2, 2005 at 11:39 pm

Wow, I must say this looks like an awesome peice of software. Its just a shame I dont have a Mac.

37 Dan December 3, 2005 at 9:34 am

Wow – This is incredible…

I -love- snippets. Being able to add: IPB simple_construct queries with a hit of a tab is awesome. :D

Rikki – Do you use svnX? If so – how did you set up the repos-update on hotkey thing?

38 Dan December 3, 2005 at 9:41 am

Doh! Nevermind – It’s built in. Even better!

39 Rob December 3, 2005 at 8:22 pm

Agreed on TextMate. I bought a Mac Mini to play around with OS X. I had no idea TM existed before I bought it. I found it my second day of using OS X, and I paid for the license on the third day. Now it’s the only thing I develop on, I love it.

40 Don Wilson December 4, 2005 at 6:18 am

After using TextMate to develop some HTML templates it’s fantastic. I really love the snippets and can’t wait to try it out with some actual PHP usage.

41 Danny December 14, 2005 at 10:12 am

Grr damn it, you guys just made me want OS X that much more. I’m getting a mini soon, with soon beeing around 2-3 weeks. :D I’ll give it a try. ;)

42 Ken Liu February 3, 2006 at 5:55 pm

TextMate is certainly great, but surely there are more exciting features than snippets – Java IDEs have had this sort of things for 3 or 4 years now. If you want to see the state of the art in IDEs, check out IntelliJ IDEA. Unfortunately it doesn’t do PHP…

Surprisingly, PHP is really lacking as far as IDEs go despite its popularity.

43 alyssa February 10, 2006 at 10:00 pm

hey wats up every1

44 alyssa February 10, 2006 at 10:00 pm

hey wats up every1

45 Andrea February 11, 2006 at 10:15 am

What about and phpeclipse plugin? It’s free, open source. Few hours to install but I’m sure the best choice for every programmer. Very customizable, a lot of plugins.

46 Chris December 18, 2006 at 4:43 am

I love TextMate. One of the best features, that no one has seemed to mention, is the validation. It has increbile validation tools. The XML validation is a godsend. I am surprised how well it works with newer languages like XHTML and XML.

Comments on this entry are closed.

Previous post:

Next post: