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.
Have you seen viper?
http://www.delorie.com/gnu/docs/emacs/viper.html
LikeLike
I’ve not tried to use it; but that’s kind of the point. I don’t really want to use VI keystrokes. I know that there are packages for OS X, say, that will let you use VI keystrokes in Apple Mail and such like; but that way lies madness.
LikeLike
Nice post. I too am an emacs user and avid fan. Did try emacs on the Mac as well. Thanks FSF guys!
BTW, what you refer to isn’t called ‘cognitive dissonance’. It can be classified as simply a ‘habit’ 🙂
LikeLike
Don’t forget the outline editor. If you aren’t using an outline editor such as Leo, you’re in the Stone Age of project organization.
LikeLike
Great post. I had a different approach but the same conclusion. I started with Vim and used it for years. It wasn’t until I read about org-mode that I ever considered Emacs. Once I did however I never looked back. I have tried every editor out there and still none come close to the power of Emacs. It truly is “The One Editor to RULE Them All”.
LikeLike
I believe vi was just shorthand for “visual,” not “Visual Interface.”
LikeLike
Nice post.
I started using Vim some years ago, long before I took a look at emacs. The vi key bindings are in my fingers. I miss those key bindings in many applications.
There are initiatives to use vi(m)-style keybindings in other software:
– Vimperator (http://www.vimperator.org/) for Firefox, on the same site Muttator for Thunderbird and xulmus for Songbird
– ViEmu (http://www.viemu.com/) for some Office-software
– others?
Some other software that adopt vi-style bindings:
– Evince (http://projects.gnome.org/evince/) and Xpdf (http://www.foolabs.com/xpdf/) has them
– Google reader
– others?
Still, too few initiatives. many times I find hjkl-characters in my text/mails. :-s
LikeLike
Nice article.
Yes, happens to me all the time. Despite this, I still stick with Vim because it makes my code editing so much easier.
LikeLike
If you are having to use a different editor on the mac anyway, you should check out some of the native mac text editors. BBEdit (and TextWrangler it’s free alternative), Smultron (Simple, Open Source Editor), and TextMate are a few of the most well known.
http://www.barebones.com/products/bbedit/
http://smultron.sourceforge.net/
http://macromates.com/
LikeLike
Pranav, I stick by the term cognitive dissonance—it was two habits fighting with each other.
James, these days I’m using FreeMind for outlines; I find it much more pleasant than any text-based outliner.
Blacktiger, apparently you missed the end of the post—a stable, working Emacs for OS X is now available.
All-in-all I’m much more well-disposed to VI than I was, but I’m still an Emacs guy at heart.
LikeLike
I started out using Emacs, but the extensive use of the pinky fingers just did not sit well with me. I don’t want to need a heavily customized keyboard, and I don’t want to have hand/finger/wrist problems at an early age.
Vim may be different from all other text editing applications out there, I’ll give you that. But it doesn’t have nearly the risk of causing permanent damage, which I am pretty adamant about avoiding.
LikeLike
I’m a jEdit user across all my platforms, it looks + behaves identically and its very powerful but thats what you want from a programmers editor.
I learnt enough vi to get by as I’ve had access to machines that only had original vanilla vi at times, knowing the basics of vi became very handy, but I’m not a great fan of modality-ness. My stream of concious is not modal and vi’s schizophrenicness drives me crazy. But it is what it is, like emacs, its what you get used to.
LikeLike
Viemu doesn’t just work for Office apps (Outlook, Word), it also works for Visual Studio and Sql Studio. I develop on the Windows platform, and between Viemu and Vim itself, I can do all Vim all the time. (Then I pop over to my Mac at home and fire up MacVim.)
But of course there’s nothing wrong with being an Emacs guy…I’m tempted by Emacs Lisp, myself. Emacs + Viper might become my ultimate solution.
LikeLike
Can’t argue with almost 20 years of finger-training, but in 1984 I bought this thing with a mouse. And since then all the editors I use have menus and respond to the mouse. It’s surprising how little trouble I have switching between them.
LikeLike
A small correction: it’s ‘d%’, not ‘%d’, that does what you say it does, although an expert vim user would use ‘da(‘, since it works anywhere inside a pair of parentheses, not just when you’re positioned on the opening one.
LikeLike
You’re absolutely correct; it’s “d%”. I remember trying “da(” as well.
LikeLike