News Flash

Really excited about Twitter's new @anywhere platform. We'll be talking a lot about this at @chirp next month: http://bit.ly/dmBydU

Blog:

9 April 2006

Review: TextMate

By Gillian Carson

TextMate

TextMate is not just a text editor for Mac OS X, it’s ‘the’ text editor for Mac OS X. Or at least if you believe the hype. Created by self-confessed UNIX geek, Allan Odgaard, TextMate has quickly risen to the top spot when it comes to Mac editors and now enjoys a somewhat charmed life in the glow of developers the world over. So the question is, what makes TextMate so special? Let’s have a look.

Generally speaking there are two reasons why TextMate has been able to push so many people’s buttons. Firstly, common conventions are elegantly handled by TextMate’s intuitive interface. In short, the software does a lot of things for you without getting in the way. Secondly, when you open TextMate you’ll notice it consists of a window and a standard Mac OS menu. The UI is certainly simple to look at. There are barely any icons or visible features at all. Yet underneath this there are so many features packed in that it is comparable to any other fully-featured text editor. You could say that its simplicity embodies David Heinemeier Hansson’s mantra, ‘convention over configuration’.

There are quite a few features TextMate that undoubtedly increase your productivity but yet are easily missed. Column Selections is one of them.

Column Selections

Columnar editing example

If you press alt, the mouse pointer turns into a cross. You can use this to select rectangular regions. This particular feature is very useful when editing HTML. For example, you may wish to add a <div> around a group of elements. To keep your indentation, hold alt, click, and drag down in a straight line. At this point, whatever you do will be multiplied on each selected line.

Quick access from the terminal: mate .

This is a great feature for those who came to Mac OS from a UNIX background. And it certainly makes your life easier. To use it, navigate to where your code’s directory is in the terminal, then type:

mate .

This opens a TextMate instance with a project containing all the files in the directory you specified, and its subdirectories.

To set up the command line tool, go to Help → Terminal Usage… from within TextMate.

Find in Project (cmd-shift-f)

This feature will come into its own during an intense re-factoring session. ‘Find in Project’ enables you to search through every file in the project for a pattern. You can enter regular expressions and replace text from the same dialog.

Search for a file faster using cmd-t

We think this feature will single-handedly be responsible for the most significant increase in your productivity once you start using TextMate. Press cmd-t to open a window that enables you to search, in real time, for any file in the project. Any letter you enter is matched, so you don’t need to enter ’controller’ to find every controller in your Rails project. Like the others this feature is simple but immensely useful.

The file search window when using cmd-t

Bundles: ctrl-escape

The bundle list

Bundles are basically collections of macros (these are called bundle items). Press ctrl-escape to bring up the bundle menu. Your current language (if applicable) will be selected from the list, and then you can easily use the keyboard to select the macro you want to use. For example, when writing PHP code you may often use this to type the names of the predefined variables, such as $_REQUEST['variable']. With this example, TextMate will automatically select ‘variable’ for you, so you can enter the variable you wanted with little effort.

Another way to access bundles is to use tab triggers. With tab triggers just type the trigger and then press tab (as in the example below). The trigger is replaced with the bundle item text. Using the previous example, you can type $_ and then press tab to bring up a list of PHP’s predefined variables.

A list of matches for a tab trigger

Even if you’re the type of person who would normally shy away from creating bundles and adding snippets, don’t worry, TextMate makes it easy. Go to Window → Show Bundle Editor. If you open up a bundle from the list, you’ll notice several icons next to the names of the bundle items. These icons represent the types of bundle items you can add:

  • Commands – use scripts to do various things in TextMate, including: replacing text, inserting text and showing tooltips
  • Drag Commands – helps TextMate handle you dragging something into the editor
  • Languages – helps TextMate work with a given language or document type
  • Snippets – pieces of text to include into your document, including: code to run at the insertion time and TextMate variables (such as selected text)
  • Templates – use shell commands to generate new files based on a template
  • Preferences – helps the editor adapt when different settings are required for the current file type

We found it was best to start adding snippets for your common coding tasks. This helps you get used to working with bundles. TextMate’s help section has all the information you need to create bundle items, including the syntax for snippets. Just click on the question mark after you’ve created a new snippet to find out more (see the example below)

Finding help for snippets is easy

Handy bundles

You may want to use TextMate to write weblog entries. Many weblogs and content management systems generally use Textile, so it’s nice to be able to
preview Textile before inserting the text. To do this, select Textile
from the bundles menu. There’s also a shortcut key set up for this bundle: ctrl-alt-cmd-p. However, you must have Textile selected as your language to use the shortcut.

TextMate also has bundles that help with version control. Many people use
Subversion, so the TextMate Subversion bundles menu is obviously very useful. You can commit changes and view diffs with very easy to read syntax highlighting. All of which will add to your productivity.

Macros

The software also has support for traditional macros and in true TextMate fashion they are extremely easy to use. You can activate and save a macro by pressing alt-cmd-m. Then, to replace the macro you just created, press cmd-shift-m. You can save the macro to the Bundle Editor by pressing ctrl-cmd-m and to view the available options for macros, look under the Automation menu.

What’s the downside?

We’ve talked a lot about what’s great with TextMate, but in which areas does it fall down and where can it be improved upon? There’s a few interface issues: it doesn’t handle lots of tabs very well and the distinction between macros and bundles confuses new users. Undo behaves differently to many popular editors — when you press undo it reverts changes letter by letter, rather than a set of changes. Many editors for Windows and Mac OS support FTP and SFTP, but TextMate only does through another FTP client (Personally, I use Panic’s Transmit.) This could make using TextMate awkward for you if you’re used to having this feature.

If you’re using TextMate to access files on a remote filesystem, there’s a few glitches that occur: TextMate can stick as it polls the remove files when you bring it into focus. This can unexpectedly change the position of the files in the project draw. Finally, there’s no way to search for text within a directory, you can only search an open file or across the entire project. Project searching works 90% of the time, but can produce too many results for a large project.

Community, support and themes

Certainly one of the ways in which TextMate has captured the community’s imagination is through its support of plugins and themes. You can easily change the software’s behavior or color-scheme which is if you want to personalise your prefered working environment and workflow quirks. Another boon is the TextMate community and wiki which are good places to find plugins and themes, as well as the User Submitted Themes list.

TextMate also works with many popular Mac OS X applications.
For example often you may need to login quickly to a server and change a script. In this case you would open Transmit, ctrl-click a file and select ‘Edit with TextMate.’ This opens the file in TextMate and automatically uploads the changes when your save it.

Another thing that sets TextMate apart from its rivals is its promptness in replying to support e-mails. When writing this review we emailed the support team with a query about how TextMate handles Mac OS X’s remote volumes, and they promptly responded. Generally, it’s rare to encounter this level of support with online software.

In conclusion it’s clear thatTextMate does deserve the applause it has been getting from certain camps. And once it has perfected the handling of tabs and working with remote files, it will be nigh-on perfect.

Rating

  • Software name: TexMate
  • Maker: Alan Odgaard
  • Price: 39 Euros ($47, or £27)
  • Rating: 4 out of 5
65
HTML5 Online Conference April 12 2010

65 Comments

Have your say:

Sign Up to our Newsletter

Enter your e-mail address below to receive regular updates on web design, web development and web business. Subscribe today and receive a free 44 page PDF "Designing Web User Interfaces" by Ryan Singer of 37signals.

Subscribe to the Think Vitamin articles RSS feed

HTML5 Online Conference April 12 2010

News

Twitter

Follow us on Twitter

Subscribe

Article Subscribers

Feedburner blog subscriber indicator

News Subscribers

Feedburner blog subscriber indicator

Subscribe by Email

You can receive Think Vitamin updates via email. Just pop your email address in the box below and click the arrows.

Subscribe by RSS

You can also receive new Think Vitamin posts via your RSS feed reader

Subscribe RSS Think Vitamin is a proud member of the Smashing Network

Ads Via The Deck