06.10.05
What I like about TextMate
TextMate has quickly become my left hand (I am left-handed). I could not possibly live without it right now. Here are some of the reasons:
First and foremost, it is extremely stylish without sacrificing on performance abilities. This is an editor that was built with both a regular user and the programmer in mind. It has a very simple interface, without many bells and whistles, but do not let that deceive you, we are talking about a very powerful editor, almost paralleling vi and emacs in terms of power. On the other hand, it integrates seemlessly with other applications and the rest of the operating system. So drag & drop works wonderfully.
In fact, while talking about d&d, you can define Drag Commands, which allow you to insert as snippets various texts, depending on what extension the dragged file has and what language the receiving document is considered to be in.
Speaking of languages, there are more than 60 different Bundles, each supporting a different language, from AppleScript to XML to Matlab, you name it. These are maintained by a number of people, who are active users of the respective language they are working on, and hence know what one would typically need.
The reason these bundles are so well developed at this point (keep in mind, this is version 1.12b at the moment!) is that the author of TM, Allan Odgaard, has been very wise and careful with the structure of the program. In effect, he has designed it so that it is very easy for people like me to write commands and snippets do useful things. In other words, it’s extremely customizable.
So what is a snippet? Well, it’s really just a small piece of text, that has a good chance of being used more than once, and that has the ability to be dynamic. For example, there is a “wrap selection in tag” snippet, in the HTML bundle, which, given some
selected text, creates<p>selected text</p>makes the firstpselectable. The cool thing now is that any change gets reflected on the secondpas well. So if one were to typecode, then they would be looking at<code>selected text</code>. Now, at the press of the tab button, the carret will move right to the end of the above block, allowing you to continue right where you should be. And this is just a tiny piece of what TM snippets can do for you.The other key feature of TM is how well it integrates with the Terminal, and the underlying Unix kernel. This means you can call any command line and have it process input from the text. For instance, suppose you wanted to multiply 567432 with 3454634. The you would type in a line
567432*3454634, and then would select the text, and then press Shift-Control-C, and voila,1960269879888. TM in the background communicated with the command line tool calledbc, which is a pretty powerful calculator. Or you could typels, and then press Control-R, which executes the current line as a command in the terminal, and then you will see a list of files in the current directory. Typingpwdand pressing Control-R will actually show you what the directory is.Most of all though, it’s the little things that matter. Suppose for instance that I have just realized that I would like to move a piece of text 15 characters to the right. Sure I could copy and paste it, but then I will not have directly available what I had last copied. Sure, TM supports clipboard history, in fact Control-Option-Command-V brings up a nice little window with a list of all the things you ever cut or copied in that session of TM and you can select whichever you want. But I don’t want this thing in the clipboard, all I want is to move it 15 characters to the right! Well, TM has the solution. Pressing Ctrl-Cmd-RightArrow moves the selected text one character to the right! Simple and elegant, and perhaps the feature I use the most.
Well, there are lots of other reasons, but these are enough for now. Just try it out for a month, and if you don’t like it, don’t buy it!