Introduction

Hi everyone, my name is Alex Vazquez and I’m one of the new additions to the Wufoo Team. Because Chris, Kevin and Ryan prefer OSX and work primarily with PHP and JavaScript, they naturally wanted me to try moving over to their favorite development environment, Textmate. In this article, I thought I’d share some of my experiences making that switch from the perspective of someone used to handling large IDEs.

PayPal Integration

The right development environment can save a programmer countless hours and is like a hammer in the carpenter’s tool belt. Since my background was in Java, my preference was for large sledge hammers and my development environment of choice was the de facto Java IDE Eclipse. It has a number of amazing features like autocomplete, refactoring and hundreds of plugins for every task imaginable. It’s no secret Java requires mountains of code, but Eclipse was made to move mountains.

In the beginning, moving over to Textmate felt like I was given just paper and pencil to do my job. The truth of the matter is that IDE lovers like myself usually imagine something like Notepad when a developer mentions that all they use is a text editor to write code. This is usually what we’re thinking:

Okay that’s cute, but seriously where do you do your development? You’ve got to have some real tools somewhere. I mean they do give Eclipse away for free you know. Like free as in free beer.

Aesthetics

While my conversion to Textmate was a bit slow, one of the first things I quickly fell in love with was their Twilight theme for color coding programming syntax.

textmatetwilight

If Twilight doesn’t quite cut it for you, I highly recommend trying out the Vibrant Ink color theme by Justin Palmer. It was nice to know that if I was going to be using something “dumb” it was at least going to look pretty. In fact, the entire application is very beautiful, which is one of the nice side-effects of working on a Mac. I also found that the details in a number of simple features like ‘Find in Project’ were really well done.

Shortcut Keys

Learning Textmate’s shortcut keys went a long way to making me comfortable with the editor and speeding up my development. Shortcuts work best when they feel like a reflex. I knew it was going to take some time to undue years of habits cultivated in another environment and so I prepared myself to be patient during the process. Because Textmate has such a minimal interface, using shortcuts is actually a crucial part of executing functions and commands efficiently in the application. Here are some of my favorite shortcuts in Textmate:

Commands I’ve Committed to Memory

Action Shortcut Keys Phonetic Version
Jump to File ⌘ T Command T
Find ⌘ F Command F
Find in Project ⌘ ⇧ F Command Shift F
Use Selected Text in Find ⌘ E Command E
Inline Find ⌃ S Control S
Reveal the Current File in the Gutter ⌃ ⌘ R Control Command R

Commands that are Nice to Know

Action Shortcut Keys Phonetic Version
Select Bundle Item ⌃ ⌘ T Control Command T
Move to Left Tab ⌥ ⌘ ← Option Command Left
Move to Right Tab ⌥ ⌘ → Option Command Right
Build PHP and Show Syntax Errors ⌃ ⇧ V Control Shift V

For a great sheet of a lot more shortcuts, check out the Textmate manual.

Plugins

Because Textmate’s API is very extensible, the plugins developed by outside parties are both varied and powerful. Two plugins that went a long way to making Textmate feel more complete to me were the Missing Drawer and SVNMate.

missingdrawer-screenshot

The Missing Drawer plugin moves the file browser out of the drawer interface and into a side bar built into the project window so that it looks like a seamless extension of the editor.

svnmate

SVNMate visually displays the SVN status of files and directories in your file browser using color and shape coded icons. An integrated visual system likes this is really nice since it helps me avoid having to go back and forth with an external SVN client to see what I’m currently modifying. For a list of other plugins available for Textmate, check out the Plugin Wiki Page.

Bundles

The true power of Textmate comes from its bundles. Bundles are snippets of code that help to extend the functionality of the application as you edit text. They’re usually triggered by key commands and tend to be language specific. It wasn’t until I learned about how to use and create commands and snippets, that Textmate became more than just a pretty text editor to me. Textmate has over a hundred available bundles. There’s so many that it actually helps to hide the ones you don’t use regularly using their Bundle Editor.

The genius of bundles is that they can be written in any of the major scripting languages (PHP, Python, Perl or Ruby). Developers from any language can easily extend the functionality of Textmate within minutes of learning how Bundles work. The entire Unix shell is even at your disposal, including GREP, SED and AWK, which are all right there and accessible from the text editor. Textmate also provides tons of examples so you don’t have to start from scratch. You can even view the source for the built-in bundles right in their Bundle Editor, although most of them seem to be written in Ruby.

A perfect example highlighting the beauty of bundles is the TODO bundle. A commonly excepted comment in the programming world is TODO, which notes tasks that still need to be done.

/*
TODO - Escape all output from this function.
*/

Development environments then take all of those comments, and combine them into one todo list with clickable links back to the code. This is great, but since the TODO comment is so common, a lot of third party libraries use it generously throughout their code, which means your nice list has 100’s of items that you will never touch. To solve this, just go to the TODO bundle and select preferences. You can ignore TODO, and make your own such as ALEXTODO, TIMTODO and RYANTODO. Then, in your code place:

/*
ALEXTODO - Escape all output from this function.
RYANTODO - Implement error handling.
*/

This will provide us with two todo lists, separated by developer, and with no todo items from third party libraries.

Textmate TODO

While this isn’t earth shattering, it is pretty convenient. Thanks to the simplicity of the bundle system, it allowed us to tweak the source code to meet our specific needs with little hassle. In comparison to Eclipse, extending Textmate is a breeze.

So far, I’ve written a shell command that opens my SVN client, SVNX, without leaving Textmate and a command that formats text into a PHP comment block using Wufoo’s standard format. I did it in a few minutes and they’re both written in PHP. For more information on implementing Textmate commands in PHP, I recommend Cirian Walsh’s article on the subject. You’ll want to take a look through the source, text and PHP bundles functionality. With just a few custom commands, Textmate has quickly and easily become a personalized PHP editor for me.

Final Thoughts

Right now, the possibilities with Textmate seem limitless. The simplicity of the application and the ease of its extensibility is too inviting to ignore and I’m very excited about seeing how far I can push this little editor. It’s beautiful, lightweight and speedy—attributes that weren’t associated with my old Eclipse IDE. Because Textmate has a very strong following, there’s a lot of blogs and resources covering its use. Two must reads are Circle Six and the excellently executed Textmate manual. If you still can’t get enough after that, here’s some links to help you get the most out of my new favorite environment :

HTML Form Builder
Alex Vazquez

Eclipse to Textmate: An IDEological Change by Alex Vazquez

This entry was posted 2 years ago and was filed under Features.
Comments are currently closed.

· 16 Comments! ·

  1. Gabe · 2 years ago

    I tend to agree with Steve Yegge about what makes a good development environment (http://steve-yegge.blogspot.com/2008/04/xemacs-is-dead-long-live-xemacs.html). Granted I haven’t done serious work in an environment where an IDE is necessary, but I have used them and they’ve never felt right. I prefer agility.

  2. Ryan Campbell · 2 years ago

    When dealing with PHP, I think some IDE features have their place. I think codesense is sorely lacking, so hopefully Textmate 2 solves that. Another nice feature of IDE’s is the ability to jump to a function in another file. Ctrl-T in Textmate helps in that area, but it isn’t exactly the same. But even still, I’ll take a lacking agile Textmate over a clunky IDE.

    Another keystroke tip is Command [ to decrease indent and and Command ] to increase indent.

  3. Ben Rasmusen · 2 years ago

    Great write up. I’ve been using TextMate for my entire development career and have actually thought about moving to an IDE. This is the first article I’ve seen where the opposite move is being discussed. I love TextMate and it’s simpler interface and like you said, the tab triggers and keyboard shortcuts are the icing on the cake and what really make it stand out.

    P.S. Here is a list of my Top 15 TextMate shortcuts.

  4. Brian Culler · 2 years ago

    When Textmate gets the ability to mimic Eclipse’s “Jump to a function definition in another file just by clicking the called function anywhere else” functionality, please let me know. Its the only thing thats stopping me from switching back.

  5. Dan Lewis · 2 years ago

    Emacs +1

    This post reminds me of that quote on Java by Guy Steele: “We were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.” TextMate to me feels like “We were after the fat IDE programmers, your Visual Studio and Eclipse users. We managed to drag a lot of them halfway to Emacs.”

    I open (or restore) my Emacs at the beginning of the day and I close (or minimize) it when I leave. People have been hacking on it for decades, and you’ll have all that power at your fingertips (along with (require ‘cl) for many of your Common Lisp needs). I find its shell to be superior to vanilla terminal, just like you do in TextMate, apparently, because I have so much power in the environment.

    I agree that it is a big relief to get out of fat IDE land and into extensible editor land. It has made a huge difference in how I approach making software and in how happy I am to come to work every day. Best wishes as you go forward into the new world!

  6. Eric DeLabar · 2 years ago

    Timely post! I was just starting a holy-war on my website about how I’m switching from Eclipse to Textmate for Java development. I absolutely love the “preference for large sledge hammers” thing so I hope you don’t mind that I quoted you!

  7. John Topley · 2 years ago

    It’s interesting that you mention TextMate’s Find in Project feature, because that’s generally considered to be one of it’s weakest points!

  8. Alex Vazquez · 2 years ago

    It seems like folks want something more than find in project and that’s why they have complaints. I’ve seen a lot of folks want jump to method or jump to class style functionality. Trust me I’d like to see these myself but I still think the UI for jump to file is well done.

  9. Chris · 2 years ago

    One of the best things about Eclipse is highlighting the name of a method and hitting alt+shift+r (rename). Changing the name of the method and hitting the enter key renames every call to that method in your project. The refactoring tools in general are what keep me in Eclipse.

  10. Michael Whalen · 2 years ago

    @John Topley: Yea I’ve always dreaded using that feature as well because it is soooo incredibly slow. But recently, as in the past few weeks, it’s been excellent! I’m not too sure what it is because there are a few factors of my development env that have changed recently, but I certainly love using it now. I’m working on an 8-core mac pro now most of the time opposed to my macbook pro (however, it seems to be blazing fast on the macbook pro too now) and I am also now running the “Cutting-Edge” releases of Textmate which haven’t given me any problems.

    @Alex Vazquez: In a currently open file you can jump to a class or method (bottom of the window, dropdown on the far right), but you can’t do that project-wide (as far as I know) with Textmate.

  11. rborn · 2 years ago

    I switched to mac a little time ago, coming form linux world. I am a PHP, Javascript developer, and i tried to find something more like Quanta. Textmate need some effort from the coder, to get used with, but once you got it….is addictive. Anyway I missed a code structure extension, and a way to open under tabs, not windows more files, not related to a projects. I found the solution for this, even if only partially. I wrote this article: textmate tricks that tells how to do this.

  12. Patrick · 2 years ago

    Thanks for this great write up.

    I’m using a slightly modified Sunburst theme which can be found at http://wiki.macromates.com/Themes/UserSubmittedThemes

  13. Jak · 2 years ago

    Great review, i’m definately going to give textmate a try.

    I’m a web developer and i’ve been using Coda by panic for a long time, you should give it a try because its great when working with remotely hosted files.

  14. alan blount · 2 years ago

    I highly recommend jEdit… similarly extensable w/ plugins and language support for almost anything, and it java based, so i can take it to my windows/mac/linux platforms and it travels with all my settings.

  15. phpghz · 2 years ago

    Great review,

    Textmate is nice editor „ but i m using textmate port for windows called E-Texteditor + cygwin

    adding features like intellisense will be great

  16. Rexibit Web Services · 2 years ago

    Eclipse is a great editor. I found it a couple months ago and have enjoyed it for Java programming.