Emacs versus vi

Why are we hiding from the police, daddy? Because we use emacs son, they use vi.

emacs/vi t-shirt

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 entry was posted in System Administration and tagged , . Bookmark the permalink.

7 Responses to Emacs versus vi

  1. Pingback: Top Posts and Commenters for February 2011 | Jeffrey's notepad

  2. Pingback: Top Posts and Commenters for March 2011 | Jeffrey's notepad

  3. Pingback: Top Posts and Commenters for April 2011 | Jeffrey's notepad

  4. Pingback: If necessary, use your favorite tool | Jeffrey's notepad

  5. 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…

  6. Michael Stack says:

    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:

      sudo [apt-get|yum] install emacs

      {slightly kidding, of course!})

      Jeffrey

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>