TextMate

BBEdit, vim, Emacs

Until recently I thought BBEdit was the best possible editor for the MacOS. I probably was influenced by my previous experiences (I used BBEdit years ago, before I switched to *nix). In fact I was amazed how simple was to do complex queries (in fact it was easier than vim from a psychological point of view), and project wise or directory based queries are as easy to do as standard queries.

Moreover in that period I needed a tool with good HTML and site management capabilities (and BBEdit has them both, and in fact for HTML projects is in my opinion still the best tool out there) and it is fully scriptable (and files can be partially generated by scripts, which is good).

These qualities made me forget about other things I looked for in an editor. That is to say: I want to use an editor that lets me code faster, helping me in manipulating text. BBEdit has extensive facilities, but most of them are really not immediate.

Basic text handling is somewhat poor (for example indenting). It’s best feature (glossaries) are not really useful for what I do most of the time. Still I liked it. It was better integrated with the mac os environment. This is the main reason because I did not use Emacs or vim: I am quite skilled in both of them, for I had to work on machines where one of them was not available. Mac ports exist, but are somehow less “native”.

Vim does open a single window per application, and if you want to have more windows you need more applications, and that is not extremely practical.

If you are interested in an Emacs version that is MacOS friendly, read this.

The key question is: it is that important to behave like a Mac application? What does it mean being a “mac application”?

You’ll be reading a more complete post on Mac philosophy on this blog later on. Right at the moment we can summarize: Apple philosophy is to keep things simple but not simplistic.

About the Apple UI there are lots of documents out there, but it’s no mystery that nor vim nor Emacs follow Apple guidelines (and that makes perfectly sense, it’s not a critic).

An application well integrated in its environment, works better. It’s easier to use, you already know shortcuts, drag n drop behaves as you expect, integration with LauncherServices is present and so on. That is the reason I preferred BBEdit to vim or Emacs (now both Emacs and vim have some integration features, but do not have them all), even if I was skilled in both and they both have features BBEdit hasn’t (and the features BBEdit has they haven’t are not so important to me, in fact I found out my use of BBEdit is really basic: I’m a lot more into TextMate).

TextMate

When I tried TextMate for the first time, I thrashed it almost immediately. It missed CVS and SVN support (and BBEdit SVN support was wonderful — unfortunately I’m not using SVN anymore). In fact I did not give it any chance. I had just bought BBEdit and was learning it’s more complex features.

I wasn’t ready for TextMate.

Text editing

Text editing is smooth. You can use all Cocoa standard shortcuts (that borrow heavily from Emacs) and Cocoa spell-checking is builtin. Fonts are smooth and beautifull.

TextMate does “smart typing”, that is to say when you type a bracket or quotes, both the opening and the closing bracket or quote is typed and the cursor is placed inside. The first times I met with this feature (and it was with some IDE’s) I hated it. Now I can’t live without and I do a lot of mistakes when typing with something that does not support it. In fact I think it makes you save a lot of typing and a lot of time.

TextMate has other smart features, for example you can edit more than one line in a time (and the key are rectangular selections of any kind)

Folding is supported, that is to say you can look at the code with the level of granularity you chose. You can collapse blocks you are not interested and expand them when you are not interested.

Another useful feature is auto-completion: it’s not as sophisticated as some C++ and Java IDEs since it’s based on typed text rather than “possible code”, but it has the advantage it applies to non-static languages too (Perl, Python, Ruby).

In fact TextMate can be used to code in C or C++, Java (even if it lacks some useful features that are necessary do to poor language design), Perl, Python, Ruby and a lot of other languages. Moreover it can be easily extended to other languages.

The most interesting thing is that you can define macros that put inserted text in more than one place. The most simple example is with HTML. Most HTML tags are kind of <tag></tag>. With TextMate you just say insert a “tag pair” (that is to say <p></p>, since p is one of the most used tags), and the editor will insert the text, selecting the first “p”. Then you can type the correct tag (for example h3, or maybe table) and the closing tag will be updated accordingly. This makes a lot less typing: and can be used in clever ways for other languages too (think about latex environments).

The last (well not really) interesting feature is macro completions. You can easily define macros and type only a few characters, then tab complete. This is great.

The beautiful thing is that TextMate can be easily extended. There is a lot of support for many languages (unfortunately not for Prolog, and that is something I miss a lot, even not enough to write my own bundle).

Organize code

TextMate has some basic project managing. It can be further extended with TmCodeBrowser.

It’s improving in this field. It can also import projects from Apple’s XCode.

To be completely sincere to manage this website I prefer BBEdit (however most “text editing” and maintenance is made with TextEdit). I miss an FTP browser (I know this is controversial and the “current” solution is to have TM interact with FTP clients, I also do this, but sometimes it is just to good to directly edit).

And remember that TextMate + BBEdit do cost less than Dreamweaver (and produce better code — of course this does not apply if you write code manually with DW, but then I think TextMate text editing facilities are just superior).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: