A friend once told me, “Will, you can go from 0 to Geek faster than anybody I know.” Let the reader beware.
I’m a software engineer by profession. That means that my number one tool, the tool I spend hours a day using, is a text editor. Not a word processor (though I use those, too), and not just any text editor; a programmer’s text editor. Notepad is a text editor, but comparing it to a programmer’s editor is like comparing a letter opener to a Leatherman tool.
Some programmers prefer to use an Integrated Development Environment (IDE), that combines a text editor with all sorts of ancillary tools, including the language compiler. But long-time programmers tend to have an old favorite, the editor of their youth, that not only does everything they need but which is graven into their very soul. IDEs come and go, but the classic programmer’s editors live on. Better to stick with the tried and true than to master one set of quirks after another.
My favorite editor, the one that I’ve used since the early 90’s, is Emacs. I’ve used Emacs on Windows PCs, on Mac OS X, and on a variety of flavors of Unix. One of the things I like about Emacs is that it’s the same on all these platforms. If its conventions are different from those of most other applications, it’s because it’s older than they are; and anyway, I’m used to its quirks. That said, getting Emacs to run on OS X has always been a bit of a chore. I’ve generally had to find the Emacs sources, download them, and build Emacs myself; and then, when I upgrade my OS, my build always breaks and I have to download it again. Some while back, though, the Free Software Foundation finally produced an OS X-native version of GNU Emacs: a genuine OS X application. When I upgraded to OS X Leopard, this was the version that was available, and I downloaded it. And yea, verily, it stanketh. All sorts of little things didn’t work quite right; and maddeningly, the cursor would occasionally leave ghost copies of itself as I moved around a text file. And because there was now an official GNU pre-release, the sources I’d relied on for Mac-specific build instructions had all dried up.
To be fair to the FSF folks, the OS X release was alpha software; but it was the only release of GNU Emacs that was available, and it was a real pain to use.
This past October, a little after I started working on Robbie the Robot, I began looking at alternatives. Now, there are other versions of Emacs, but I discounted these immediately. I could probably have found an OS X-specific version of Xemacs; but I’ve never liked Xemacs. There’s another version called Aquamacs, which makes Emacs look even more like a standard OS X application; but it changes the standard behavior to do so. My goal is to use one and the same editor on every platform I use; and I use Windows, Linux, and OS X. So that was out.
Next, since I use a lot of ActiveState software, I decided to try KomodoEdit, the free version of ActiveState’s Komodo IDE. It’s available on all three platforms, and is pretty much the same on all of them. I used it for the rest of October and most of November, and I have to say that there’s a lot to like about it. I got comfortable with it, once I got all my quirky preferences dialed in, and was quickly productive. I have to give the ActiveState guys credit; they nearly got me long-term. In the end, I abandoned KomodoEdit for three reasons:
- There are functions that I use regularly, such as incremental search, that are just slow enough to be annoying. I want my editor to be faster than I am.
- Most programmer’s editors let you remap the keystrokes to do what you want, and Komodo is no exception. In fact, I really like the interface it uses for this. But Emacs lets you change the keystrokes depending on what kind of file you’re editing. For every kind of programming language, you can have the precise tools you need at your finger tips. If Komodo can do this, it wasn’t obvious.
- Keystroke macros execute much more slowly than in Emacs (orders of magnitude more slowly!), and are buggy besides.
KomodoEdit worked for me most of the time; but there were times when I found myself falling back to Emacs because getting the job done in Komodo was just too painful.
So what next? Alas, there was one obvious choice remaining…a name I shudder to speak. For an Emacs user to even think about it is rather like Luke Skywalker going over to the Dark Side. Yes, it was time to take a look at….Vim!
For those of you who came in late, the two (2) (count ’em, two) classic programmer’s are Emacs and VI. (The names stand for “Editing Macros” and “Visual Interface”.) Both were written to convert editors designed for use on teletype machines into something that was more pleasant to use on a CRT screen. In doing so, they took radically different approaches. And both have evolved considerably since then, meeting the needs of successive generations of programmers. The classic “vi” is still available on pretty much every Unix system, but most “vi” programmers these days use ViM (VI iMproved), which is has considerably more functionality.
I’ve never been a “vi” user; I know just enough to some very simple editing and save a program. But it’s the preferred tool of millions of programmers, and perhaps it was time to take another look. Like Emacs, ViM is an old-school editor, proven on the field of battle; like Emacs, it’s available on every platform; and, as I quickly discovered, the OS X version is compatible with the versions on the other platforms, and stable to boot. So I spent the second have of November giving ViM a try.
Much though it pains me to say it, it’s a good tool. I was able to configure it to work the way I wanted, and I was able to be productive in it. I got it to work identically on Linux and on OS X. It had some quirks that I didn’t like; but Emacs has some quirks that I don’t like. I’m just used to them.
In the end, though, I returned to Emacs. Not because it’s as familiar as an old glove, surprisingly, but because ViM was becoming too familiar. How can that be, you say? As I mentioned above, Emacs and VI took very different approaches to managing a screen interface. And the plain, simple fact of the matter is, Emacs won. The applications that you non-programmer types use that involve editing text—word processors, especially, but also e-mail programs and so forth—owe a lot more to the Emacs-style of editing than to VI. In fact, I can remember a number of applications in days gone by that took a VI-like approach to text; does anyone remember the “Select” word-processor? Ultimately they all tanked.
The basic difference can be described as follows. In Emacs, as in almost every other application, typing a letter on the keyboard inserts that letter into your document. You move around using the arrow keys and so forth. You use control-keys, function keys, and menus to perform more complicated operations. In ViM, your keyboard is like a giant game-pad of editing functionality. Every key does something amazing and magical. If I type “%d” on a line containing a left-parenthesis, for example, ViM will select and delete everything from the left-parenthesis to the matching right-parenthesis, taken into account any nested parenthesis, quotations, and so forth. In order to actually input text, rather than edit it, I need to type “i” (or any of a dozen other key sequences), enter the text, and then press Escape to go back to command mode.
Frankly, this odd scheme works. It works well. Once you become fluent, you can accomplish amazing things with much less typing than in other editors. But! It doesn’t work in anything else, no matter how often you try. It is very disconcerting to be writing an e-mail, need to edit something you’ve typed, and have your fingers try to use the ViM commands to get the job done. Cognitive dissonance, they call it.
So I decided, somewhat reluctantly, to give ViM a pass. I gave up on having the same editor on all three platforms; I’d use KomodoEdit on the Mac, and Emacs everywhere else, and maybe someday the FSF guys would release a stable, non-stinky version of Emacs for OS X.
And so, last week, just before implementing this decision, I did a quick web-search—and, lo and behold, there’s a new stable release of Emacs, 23.1. And it works just great on OS X. Glory, glory, hallelujah, I’m back in business. Bye, bye, ViM. Bye, bye, KomodoEdit. It was nice knowing you, but it’s good to be back home.