I have the ThinkGeek t-shirt with the little boy and his dad peering around the corner at the cop car and the boy asking “Why are hiding from the police, daddy?” to which Dad responds “Because we use emacs son, they use vi.”
Of course there’s also a different version of the shirt where the words emacs and vi are reversed, but that’s the whole point—some people use vi and others use emacs.
Jeffrey Aside
If you’re not familiar with either vi or emacs, it might make sense to stop right here.
Then again, it might also make sense to go do some Googling/reading and come back.
One of fellows I follow on Twitter (@jandrusk) posted a link to a long (and old) list of reasons to like emacs over vi. I posted my agreement to my followers. So far, there’s been three types of responses:
- emacs isn’t installed by default, but vi is, so use vi (link)
- I used to use emacs and once I tried vim (a vi variant), I never went back (link)
- I like the old-school feel of vi (link)
Three in favor of vi and two in favor of emacs. Frankly, I was waiting for the rebuke about starting holy wars about such subjects, but it hasn’t come (yet).
I prefer emacs to vi for a few main reasons.
- It was the first editor I used on those NeXT boxes in the late `80s.
- The keystrokes were largely compatible with Interleaf, the desktop publishing tool I first wrote code for.
- Both Interleaf and emacs share a huge LISP background and heritage.
- Emacs feels like a code processor rather than just an editor.
I find that I have to add several other tools to vi to get the same things done (grep, awk, sed and bash) as what I can do in emacs. In short, I’m comfortable (through long experience) getting complex things done in emacs.
And that highlights the whole argument. We use what we use largely because given a choice, that particular editor is what we prefer. They both edit text files well and that’s the job that needs done sometimes when you’re a System Administrator.
But since a System Administrator is going to find vi on every machine they work on, learn vi first. And after that, dabble in emacs.
So, what’s the answer to the question emacs or vi?
Learn vi, then explore emacs.
You’ll be a poorer System Administrator if you don’t learn the tool you’ll find in even the barest of tool chests. Because ultimately, it’s about getting the job done and being productive for your client.
Update: I found the t-shirt, included a cleaned-up photo of it and changed the quote to match the shirt (20110113).
This is usually referred to as the “baby duck” syndrome, that is, the first thing you see becomes your mommy, aka preferred editor. I first learned TECO on a Dec System 10, then used FINE (Fine Is Not Emacs) which was very Emacs like and finally VI which I now use daily so perhaps I am the exception that proves the rule…
Editor wars are funny. I used emacs in school becase the teacher wrote the names of two editors we could use on the blackboard:
* emacs
* vi
I grabbed the first one I saw. I used emacs all through college, and then landed at my first job. I remember I fired up a terminal and typed:
$ emacs
emacs: not found
$
I asked one of my co-workers and he told me, “you have to use vi”.
…and that is how I started using vi[m]. I still remember a few emacs keystrokes, enough to be dangerous, but the ubiquity of vi has motivated me to stick with vi.
So, I think this post is a combination of reasons #1 and #2. I don’t think vi is Better, it just works best for me.
Michael-
Absolutely, admins must learn at least enough vi to get through the simple insert, delete, append, save steps. Sometimes vi is all you’re going to find on a given system.
(Then the next command they should learn is:
{slightly kidding, of course!})
—
Jeffrey
I own this shirt. One time I happened to bring it with me on a trip to our team in another state when a vi-emacs debate started up, so instead of wearing it as the intended nightshirt, I showed up with it the next day. Its staying power is pretty impressive.
It’s a fun shirt, indeed. I think mine has worn out and gone to that place in the sky where good shirts go when they unravel.