Print this page is sponsored by
 
www.MyMacStore.com
For all your iPod, iPhone and Mac Gear


Charles Moore Checks Out The TextMate 1.0.1 Advanced Text Editor

ReviewsWriting/PublishingMooresViewsCommentsTell-a-Friend
TextMate is a new high-end text editor for the Mac aimed approximately at the space occupied by Bare Bones Software's venerable and very powerful BBEdit, or perhaps at a space that hasn't been filled adequately on the Mac platform up to now.

Text editors are word-crunching applications oriented particularly to working with plain text, as opposed to word processors, which have a strong focus on formatting and styling text for hard copy printing or PDF media. There is a fair bit of crossover, and some text editors support a creditable degree of text formatting and styling, while some word processors (such as the Classic version of Nisus Writer) do a decent job of editing plain text, but the general distinctions noted apply.

(One text editor that has substantial word processing capabilities is Apple's own Text Edit which installs with OS X).

Personally, because virtually all my output these days is either for Web publishing or electronic transmission as unformatted copy to print media publications, I use text editors almost exclusively. Text editors are also indispensable for programmers and Web site authors, who need pure, unembellished text in pursuit of their endeavors.

BBEdit is widely regarded as the king of the Mac text editors, and with good reason. It is a very solid and capable piece of software with a rich feature set, much admired by Mac programmers and Web developers. Because it is so good, and so highly regarded, Bare Bones Software has been able to command a premium price for BBEdit - - $199.00, which is more than most Mac word-processing programs sell for these days.

That high price is the BBEdit's most significant competitive liability, and one that the developers of TextMate note wryly in a press release: "You won't have to sell your bones to buy it." However, the question is, does TextMate also constitute a credible challenge to BBEdit in terms of functionality and features? According to TextMate's co-developers Allan Odgaard and David Heinemeier Hansson, it can and then some.

When I asked him for a bit of personal background, Allan replied:

"I was active (i.e. writing software for fun) on the Amiga till at least 2000. I got a PC around that time, and used it for probably a year, also writing a bit of software, but I didn't like the OS (Windows 2K), so in December, 2001 I got my Mac (733 MHz G4 QuickSilver) -- a year later I finished my masters degree in computer science.

"I worked on and off on a text editor (and a zillion other applications), but in end of May (this year) I was offered an appealing full-time job, and so I teamed up with David to get a 1.0 release within a month, since I basically started from scratch, that goal was a bit ambitious, but I didn't get the job, so I continued with TextMate and the release finally came, as you probably know."


David notes:

"My programming work has been confined almost exclusively to the Web, so my involvement with TextMate has always been with a black box. First with the objective on how to get that box into a usable form that contained the most important features in the development time we had available. That meant working with Allan to prioritize and scope features along with the scheduling of iterations.

"Secondly, how to bring TextMate to market. Setting a price, starting a buzz, creating a website, writing the weblog, and dealing with press requests. Holding a combined bachelors degree in business administration and computer science certainly helped with both objectives.

"And most importantly, of course, is that I was using TextMate to do my day job ( http://www.basecamphq.com ) since very early in the process. So while Allan had the insight into how Obj-C/C++ should be treated, I gave him the insight into how scripting languages (Ruby, in my case) and markup should be treated."

I asked Allan and David what market they envision for TextMate. For example, do they see it as a challenger to BBEdit, or as targeting a somewhat different user base?

"That's a though question," Allan replied. "Although I have only briefly used BBEdit 6 (7?) (Lite), I view TextMate and BBEdit almost as orthogonal products."

"Orthogonal" sent me rooting in Webster's, but it is synonymous with at right angles or perpendicular, or in sailing parlance � on opposite tacks.

Allan continued:

"I got the impression from using BBEdit that what they really wanted to do was a WYSIWYG HTML editor, but instead they did a plain text editor with a wizard for every single HTML construct that you may want to create.

"I'm a programmer, so what I wanted to create with TextMate was something like a domain specific language suited for text manipulation, probably re-inventing emacs or vim, but putting a GUI onto it, that would make it less intimidating and easier to use.

"So in a way, I'm targeting everybody who wants to work with structured text, which should be a superset of the BBEdit user base, but I'm not giving any particular language special treatment, instead I'm trying to make TextMate as customizable as possible, so that all the features in your favorite IDE, can easily be mimicked by TextMate -- this however requires you to setup the editor to do what another �specialized� editor may do �out of the box� (I'm trying to remedy this by collecting language specific settings � like syntax highlight, macros, file templates, commands, snippets, etc. � to be collected in bundles, and distributed easily (we already have a comprehensive list at our wiki) and the lack of such build-in functionality may turn some away from TextMate, or for some languages, an IDE simply do offer more for that particular language (for example �code hinting� which is currently missing from TextMate, due to lack of a general system for such things)."

David weighed in saying:

"TextMate 1.0 was in a lot of ways a construction kit that appealed most to people who liked to explore and tailor their own environment. It was less appealing to people who expected to find a complete IDE for their favorite language. But thanks to the people in the first group, we've been able to approach the desires of the second group rapidly. Already, there's a bunch of people out there creating extensions, so TextMate actually is becoming a PHP or Ruby or LaTeX IDE."


And a bit of background on where I'm coming from in this discussion. I have no axe to grind in favor of either TextMate or BBEdit, being an aficionado and devotee of yet another text editor application, Tom Bender's 15 dollar shareware program Tex Edit Plus, which is really a different breed of cat. Half a decade ago, when I first started doing a bit of HTML markup, I used BBEdit, which for my purposes was analogous to using a maul hammer to swat gnats. It certainly did the job, but I was using only a fraction of its capabilities, and consequently found it a bit ponderous.

I switched to using Tex Edit Plus when I discovered that I could custom-tailor that application to do exactly what I needed it to do with no excess baggage by using its superb implementation of AppleScript support. And because Tex Edit plus also supports a substantial degree of text formatting and styling, I find it completely adequate for virtually any word processing tasks I still need to do.

However, I'm not a programmer, and my HTML authoring needs are fairly rudimentary, so for users who are heavily engaged in these categories I wouldn't dispute that BBEdit, and now perhaps TextMate, are more appropriate tools. With its deep feature set including tabs, foldings, and macros, TextMate claims to be well ahead of other native, graphical editors on OS X, especially when you're dealing with a lot of files at once, reducing the mental overhead, and turning manual work into something the computer does.

Allan and David are programmers, thus better able to discern and evaluate what is ideal in a text editor aimed at programmers. I asked them what they see as TextMate's particular strengths relative to other text editor applications such as BBEdit, Tex Edit Plus, or others?

Allan replied at some length.

"A lot of the features I needed in an editor simply wasn't available in BBEdit when I tried it. For example it did not have an overwrite mode, it didn't allow freehanded editing (i.e. where the caret is not restrained by end-of-line markers), the column-selection they introduced in 7.0 was a bit limited (i.e. I couldn't run transformations on it, I couldn't move it around, I couldn't even copy it to the clipboard and paste it a different place and have it inserted as columns -- though this may have improved since), it didn't have column-typing either, no foldings, I wasn't able to simply record a few editing actions and have these replayed for me (instead I had to write an apple script to do it), it doesn't really handle multiple files that well (i.e. no tabs, and even in their latest version, their file drawer is hardly comparable with the hierarchical project drawer TextMate offers, which can have folder references and allow Finder-like operations), their glossary is a bit cumbersome compared to TextMate's snippets, and I don't think the BBEdit authors realize the usefulness of the various shell commands, and having good integration with the editor and these (i.e. have shell commands work on the text, have their result inserted/shown, embed shell commands in snippets etc.)

"Of course much of this could be added over time, so the philosophical difference probably is that TextMate tries to be as general as possible, and also the latter thing mentioned about it tries really hard to harvest much of the power in the underlying unix/shell scripting.

"Whenever I get a feature request for something specific, I always try to figure out why my general tools are not adequate enough to solve the problem (though often they are wink ), and fix these instead of hardcoding the feature.

"I get the impression that the BBEdit authors often do the opposite.

"All that said, I really don't want to come off as bashing BBEdit. Clearly BBEdit caters to another market than TextMate, a market that I do not fully understand, and I think a lot of OS X 'newcomers' (switchers) share this astonishment, so all I can do is explain why BBEdit is not my cup of tea, but I can't really tell you what sets TextMate and BBedit users apart.

"And as mentioned above, I have only used BBEdit enough to realize that it didn't have the features I needed, maybe there are workarounds, maybe there is functionality I overlooked -- but I program as a hobby because I like it, and given the choice of writing my own text editor exactly as I want it, or pay $200 for BBEdit and RTFM, BBEdit would need to be pretty good for me not to select the first one...."

David added that

"It's often hard for people coming to the Mac because of OS X to understand some of the traditions the platform had before the renewal. We've certainly had a problem understanding how people could live with what we've perceived as a fairly limited set of options for advanced text editing.

"And it's something I've heard again and again from other switchers: 'So what text editor should I use?'. That was always my Achilles' heel when attempting to sway over Windows users to the Mac. I'm glad that I can now answer that question without reservations."





When you first start up TextMate, you are presented with a "Tip of The Day" window (which can also be summoned from the Textmate application menu). The tips are useful and helpful, but it would be nice if they had an indexed table of contents.




The TextMate interface window is simplicity itself, with no toolbars or buttons. However in the Cocoa drawer of the Textmate project window, there are four buttons that access menus and functions. You can show and hide the drawer (as well as the tab bar and status bar) from the View menu.




You can select text highlight colors.




My early impression of TextMate was that I was on unfamiliar ground � perhaps a flip side of sorts to what Allan and David experienced migrating to the Mac. The program does not abide by standard Mac interface conventions � for instance there is no Preferences dialog, which makes it a bit unintuitive for Mac veterans like me. It looks and feels more like a Linux application with some Mac-like elements added. On the other hand, full marks for including OS X Services support.

Unfortunately, the Help files were not a whole lot of help at the basic beginner level. Through trial and error I was able to figure out the rudiments of how things work, but this program really needs a manual.

Textmate features include:

Dynamic file outline

Lets you keep on top of your artifacts, such as stylesheets, includes, libraries, and application code. By arranging your files in an outline that follows the existing directory structure, it's no longer necessary to switch back and forth between Finder and editor to locate the next thing you need to work on.

The file outline is automatically kept up to date with changes occurring on the file system, so if you have a build script or generator that sprinkles files across multiple directories, they're instantly available in the outline.

You can also move files from one directory to another in the outline and the change is reflected on the file system. Just as you can easily add new files to any directory you select and they'll be placed as you'd expect.

Reorder the tabs

Once you've found the files you want, it's you can jump between them using tabs that can be reordered as you see fit. The outline overview allows for a greater number of files to be open at the same time; without constantly resorting to Expos�, minimizing, or other window managing techniques for the big picture.

Clipboard history

Each time you copy something, it is thrown onto the stack, so all previous clips still exist. By holding down shift when you paste, you go one step back on this stack, so you can easily do multiple cuts and paste them again, or you can open the clipboard history window to inspect the stack.

Hide what you don't need with foldings

With foldings you can collapse method definitions in your class files or tables and divs in your markup. That way you only get the detailed view of the active segment while the rest is available at a glance.

The foldings automatically appear following a specification in the syntax files, so all you have to do is decide what to keep open and what to close.

This is a pretty cool feature, unlike anything I've seen in other text editors.

Macros: Record and replay

Whenever you find yourself repeating the same text or transformation, you have a good candidate for a macro. Macros let's you record just about any editing task you perform, including piping the selection through a Unix command, performing regular expression replaces, or just plain and simple movement of the insertion point.

There is a selection of default macros in an Automation menu submenu.




To record your own custom macros, you activate recording by selecting �Start Macro Recording� from the �Automation� menu, and when you have performed the editing operations, you select it again (the title has changed to �Stop Macro Recording�, and while it is recording, a camera icon will fade up and down in the status bar).

The editing operations recorded are:
� Moving the caret
� Selecting with the keyboard
� Inserting text by typing on the keyboard
� Copying and pasting text (including going back and forth in the clipboard history)
� Placing the selection on the find clipboard
� Finding next/previous match with the current contents of the find clipboard
� �Execute Line Inserting Result� and related functions
� �Filter Through Command� (the command you enter will be saved in the macro)
� Opening the find panel and doing a find/replace (the find string, replace string, and the options you set will be saved in the macro)
� Performing any of the transformations in the �Text� menu
� The miscellaneous select actions (word, line, ...)
� Executing another macro (the entire macro you execute is copied, so if you later change it, it will not affect the one you recorded)

After having recorded a macro you can replay it with �Replay Scratch Macro� from the �Automation� menu.

You can also save a scratch macro for later use. Select �Save Scratch Macro�� from the �Automation� menu and give it a name and an optional key equivalent. This key equivalent does not need to include a modifier key.

Names and key equivalents for saved macros can be changed by opening the �Replay Macro� submenu and selecting �Edit Menu��.

Textmate's macro capabilities are great, but it would be nice if AppleScript macros were supported too � one of the GREAT features of Tex Edit Plus. One advantage of AppleScript is that it facilitates the compilation and sharing of pre-recorded macros through online libraries such as the one operated for Tex Edit Plus macros by Doug Adams.

Snippets

Snippets allow you to quickly insert text you type a lot. In this text you can embed placeholders (with default values) for where the insertion point should move to when pressing tab.




You can insert a snippet either by selecting it in the �Insert Snippet� submenu found under �Automation�, or by typing its trigger in a document and pressing tab.

In the most simple case, a snippet is just a sequence of text, for example you can let it be �� 2004 MacroMates.� and set the trigger to �cmm�. If you then type �cmm� in your document (either at the beginning of a line or preceded by a non-word character) and press tab (?) then it will expand to �� 2004 MacroMates.� (the trigger typed will be removed/replaced).

A snippet can either be inserted from the menu, or simply by entering the "trigger" and pressing tab, so e.g. typing "nsA" and pressing tab could insert "NSMutableArray* array = [NSMutableArray array]" and leave the former "array" selected (the placeholder).

Placeholders

It would be nice to make this useful even in a year from now, so hard coding 2004 obviously does not work. We can instead insert a placeholder using �$1�. This is done by changing the snippet to �� $1 MacroMates.�. When we insert this snippet, it will place the caret where �$1� is written (�$1� will not be inserted in the document), and then we can type the current year.

Default placeholder values

Since the year will be 2004 for at least some months to come, we can make this the default value by writing �${1:2004}�, so the snippet becomes �� ${1:2004} MacroMates.�. What happens when we insert this snippet is that it will insert �� 2004 MacroMates.�, just like the first version, but �2004� will be selected, so we can either overtype it, or leave it alone.

Multiple placeholders

Since a snippet may contain several pieces which must be typed when inserted, we can embed several placeholders and cycle between them with tab and shift tab, for example we could let it be �� ${1:2004} ${2:MacroMates}.$3�. When we insert this snippet, it will once again insert �� 2004 MacroMates.� with the year selected. Now we can either decide to overtype the year, or leave it as is. After this we press tab to move to the next placeholder, which causes MacroMates to be selected. Again we can decide either to overtype it, or let it be. After this, we can go back to the year with shift tab, or we can move forward to the last placeholder (�$3�) with tab.

When we reach the last placeholder, we leave the cycle-chain, and can no longer use shift tab to go backwards.

Mirror typing

If the same word or phrase needs to appear at different positions in the snippet, you can re-use the placeholder number to activate �mirror typing� when the snippet is inserted. An example follows.




When this snippet is inserted, �MyPage� in the title will be selected. Overtyping it will cause �MyPage� in the section to reflect the changes made to the title. When done, press tab, and the caret will move inside the section.

Note that mirror typing will not work for the last placeholder, since it would not be possible to dismiss it, as there are no defined placement of the caret when pressing tab after having moved to the last placeholder (here tab inserts a tab, rather than advance to the next placeholder).

Also note that currently if you provide a placeholder with a default value, you must add this same default value to all of the �mirrors�.

TextMate builds on Cocoa's key binding mechanism, which is completely re-mappable by the user.

Project-wide regexp search'n'replace

Find advanced patterns of text across all files in the project and replace them with elements from the match.

Jump around with bookmarks

Bookmark lines in different files across the project and jump or cycle between them with ease.

Virtual groups in the file outline
Impose even more structure on the files in your project than the file structure affords. Especially useful to keep header and class files separate even as they reside in the same physical folder.

Syntax highlighting in a nest

Colors and styles allows you to separate code from markup, keys from values, and tags from options.

HTML prototyping with Web Preview

Stop jumping back and forth between the editor and your browser to refresh how your change affected the design. Instead let TextMate refresh a WebKit-based rendering of your site on every keystroke.

More Automation Features

Smart typing

Opening a single- or double quote, curly or regular bracket, or parentheses will automatically create the closing match and place the cursor within.

Column typing

Perform the same change across multiple lines without repeating it.

Auto-complete words

If the word Basecamp has already been mentioned in the current text, you can write "Bas" and hit escape to have the word completed. Multiple matches can be cycled through hitting escape repeatedly.

David notes that TextMate is under rapid development, and are releasing new beta versions almost daily. More features coming soon in TextMate include:

Editing over Secure FTP (1.1)

Work on files residing on another machine using Secure FTP.

Integrate with CVS/Subversion (1.2)

Check-in, check-out, check-in, check-out. Why don't we sing that song from within the editor?

Being basically programming illiterate other than a bit of messing around with AppleScripting and only slightly more erudite in html, I am mot in a position to competently evaluate most the features and functionality cited above, so this article should not be cinsidered an in-depth review � more an overview of what Textmate is about and has to offer. Textmate is primarily aimed at coders. Indeed, it reminds me a lot of a now-defunct Mac Classic text editor from the late '90s called Pepper. Pepper's developer became disgruntled with the mac platform for reasons I can't recall, and bailed for the dark side, arguably laving a gap in the Mac application spectrum that TextMate appears to fill nicely.

If TextMate sounds like the sort of text editor you're looking for, it is currently on sale for $39 (regular $49 - $10 discount lasts until Nov. 1st)

For more information, visit:
http://macromates.com/ ReviewsWriting/PublishingMooresViewsCommentsTell-a-Friend


Article URL:
http://www.applelinks.com/index.php/more/2519



Next Article: Fark's "Photoshop Steve Jobs" competition

Previous Article: Ambrosia announces Darwinia for Mac OS X...ia

Print this page is sponsored by
www.MyMacStore.com
For all your iPod, iPhone and Mac Gear