It’s Text, Mate!

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.

TextMate.mov ( 2.5mb Quicktime .mov(ie) )

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?)

Seriously.

Rikki is like the TextMate cheerleader.

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

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/(.)|(?m:\n.*)/(?1:-)/g}
// ${1:${TM_SELECTED_TEXT:Comment}}
//-${1/(.)|(?m:\n.*)/(?1:-)/g}

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.

Now that is cool.

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

http://blog.mattmecham.com/blogimages/textmate.jpg

Oh yeah, another little useful thing is TmCodeBrowser: http://www.cocoabits.com/TmCodeBrowser/

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 “”

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

exit_show_html “”

Ah screw it :p

HTML stripping is a pain. :/

Regular strippers are quite fun, though :P

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

*Cries*
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.

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.

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

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.

Editplus is really good.

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.

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

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

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.

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

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.

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.

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

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

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

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

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

Well, very cheap yes. 3rd world country.

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

I use [URL=http://www.blumentals.net/webuilder]WeBuilder[URL]. Does everything I need it to.

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

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

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

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?

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

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.

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.

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. ;)

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.

hey wats up every1

hey wats up every1

What about eclipse.org 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.

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.

*
To prove that you're not a bot, enter this code
Anti-Spam Image