TextMate rocks!
Posted by marshall Wed, 28 Sep 2005 19:29:00 GMT
I love TextMate. It is the software I spend the vast majority of my time in during the day, and I'm constantly discovering new worlds of functionality in it.
When I was using Windows full-time, I used an editor called TextPad. It was an excellent editor, with easy-to-configure syntax coloring, regular expression search-and-replace, project workspaces, and other useful features.
As I started to use OS X more and more, one of the things I missed was TextPad. It seemed the editor everyone used was BBEdit -- but I never really liked BBEdit. It felt very much like a classic Mac OS program, old and clunky, and even today the BBEdit toolbars retain that old look. To add a syntax definition (which was as simple as placing a text file in a folder with TextPad), you had to compile an extension with the commercial CodeWarrior software. And at the time I looked at it, the full version was over $200 (it's since come down, although it's still seriously overpriced compared to its competition).
Then I came across SubEthaEdit. The main draw of SubEthaEdit is collaborative text editing, which I haven't ever done, but even apart from that it's a solid text editor. Syntaxes can be added and customized via plain text files (XML actually), including auto-completion. It has line numbering, a class/module/function drop-down, regular expression search/replace, auto-indenting, and various other useful features. It's a beautiful, OS X native Cocoa application -- and it's free for personal use! (Commercial use requires a quite reasonable $35 license).
There were a few things I still missed about TextPad, though. The biggest thing was the project workspace, which kept track of several files that could be switched between (with tabs or a list). I really wanted an editor that had a common IDE feature of showing a directory hierarchy (maybe as a drawer or something) and letting me pick the file from that, which even TextPad didn't do.
Then someone on a mailing list mentioned TextMate, and I took a look at it. Hmmm...easy-to-define syntax modules, line numbering, regex search-and-replace, auto-indent, rectangular selections, adjustable right margin indicator, good, good...a drawer that displays a directory hierarchy (or multiple hierarchies if desired)...code folding...tabbed documents...wow, it looked like just what I wanted!
At around $48, it's a bit more expensive than the SubEthaEdit license, but it has been so worth it. Since getting TextMate, I keep finding outrageously cool things that it can do. It has a large collection of built-in autocomplete snippets that are local to each file type, so in an HTML file, I can type something like img and hit tab, and it will fill out the whole <img src="" alt="" class="" /> tag, and pressing tab moves to each placeholder field in the tag (i.e. to the middle of each set of quotes). It has macro recording, a command-line tool, web preview, jump-to-symbol...all the things one would expect from a powerful editor. It has "shell worksheet" style functionality where you can type a shell command like ls ~/Documents or date, hit a key, and have the results of the command appear in the document. But what's really amazed me today is the command support.
The lead TextMate developer blogged about this today. Basically, you can configure any key combination to run a UNIX shell command or script, and TextMate will set up several variables that can grab information from the document and use it in the command. It has built-in commands for previewing Markdown syntax, sorting the selected data, doing web searches on the selected word, running the file in a script interpreter, bringing up a color picker and translating the result to an HTML color...all sorts of things. It also provides some built-in JavaScript objects for its web preview window, which the blog entry was discussing. The developer described how to set up a key combination to look up the selected word using the Ruby ri documentation tool, get the HTML result, and display it -- and if there were multiple results, create a list with JavaScript that calls ri for each individual entry when you click it. It's an amazing mix of a GUI editor, UNIX shell scripting, and the web.
I think I'm starting to get a feel for why emacs people love their editor so much...except the learning curve for TextMate is nearly nonexistent, I can customize and extend it without learning LISP, and it has the full benefit of a GUI environment for things like web previews. You can use it as a basic editor like Windows Notepad if you want. But you can also use it as an IDE, a command shell, a blog previewer...or whatever else you can dream up.
I tried using TextPad again recently, but it felt so limited. If I were ever forced to use Windows regularly again, I'd probably need UltraEdit or something. But that would still be a sad day. TextMate exemplifies what I like so much about OS X: the full power of UNIX with an elegant, explorable user interface.
