Editor wars thread

I don’t actually expect it to lead to a flamewar here, but I am nevertheless invoking one of the longstanding Internet disputes with this announcement: I have recently switched from emacs to vi1.
For the uninitiated: emacs and vi are the two most common text editors in Unix environments. They’re meant for editing unformatted text such as computer programs. I’m doing a lot of Unix programming these days (in Perl and C++) so a good text editor is essential. The two have fairly different philosophies: emacs does more or less what you would expect, in that you can type words and they appear on the screen, but it also has a ton of extra functions (such as programming with butterflies). Unfortunately even simple ones like, say, “save” have to be accessed by typing a sequence of obscure key commands, usually while holding down the control key.
On the other hand, if you open up a file with vi and start typing, words will not appear on the screen. If you’re lucky it’ll just beep at you repeatedly; it might also start deleting portions of your file apparently at random. Fortunately you’ll never figure out the command to save, so your original file will be unharmed; unfortunately you’ll never figure out how to quit either, and be stuck there forever (or until you open up Google and look it up).
At least, that was my first experience with vi, and having concluded that it was designed by alien intelligences I quickly became a convert to emacs. However, I recently began to question that decision, for a number of reasons:

  • Peer pressure. Almost everyone in my department uses vi. In fact, when I was assigned to a newly assembled Unix box and complained to the sysadmin that emacs wouldn’t run there, his response was “Well, most people use vim.” (He did set up emacs for me despite his disdain for it.)

  • It reminds me of playing nethack. At some point in the past I had to learn to play nethack on a laptop keyboard (i.e. without the number pad), and only later found out that I had thus inadvertently learned how to move the cursor in vi3. This was actually the biggest part of the learning curve. There are other similarities to nethack, such as the primitive-looking interface, the obscure extended commands, and the fact that a typo at the wrong time can kill you.
  • I got tired of holding down Control every time I wanted to do anything. (But hitting escape to get out of insert mode is almost as bad. Maybe I should remap it to some other key.)

Anyway, I went home one night and went through the vim tutorial, and discovered that it’s not as hard as I thought, and ended up switching entirely.
Rather than actually make this an editor wars thread, consider this a place to suggest your favorite Unix programs for software development (or whatever else).
1 Actually, vim2.
2 Well, technically gvim.
3 Except that the diagonal movement keys do other, more drastic things in vi, which can cause trouble when I forget I’m not playing nethack.

12 thoughts on “Editor wars thread

  1. Chris L-S

    I still fail to see why emacs and vi are the major text editors out there for Unix – why hasn’t something more user friendly ever been created? Of course, I guess I could just boggle at the fact that anyone is still using Unix instead of Linux. And at my own knowledge of such things – just enough to be dangerous.

  2. Wren

    Chris, there are other more user-friendly options. I use pico (nano), and have been soundly mocked by everyone for years for my choice.
    Granted, there are things that are faster and easier to do in vim, but for entering text into a file, pico gets the job done.

  3. Lemming

    I use emacs because it’s familiar. I do not have a particularly high opinion of it.
    I have far more respect for vi — I just find it’s activation energy a bit higher. I do occasionally use it, when it’s thrust upon me, but I don’t know how to do much.
    Heck, I use nano sometimes too — mainly because it’s become the lightweight editor of choice that gets installed as part of the barebones setup on several linux distros.
    Back to vi… my impression is that a lot of other programs (like Nethack, lol about the diagonal movement) modeled their keys after it. It’s light, it’s efficient, it’s good, I think highly of it.
    You know what I think is worst of all, though? People who try and force you to use one or the other.

  4. shellock

    alas i have been reduce to windows and java programer on elciple and visual studio. but back at school vi was annoying so i used emacs. And sharon still used EMACs for her job

  5. Mason

    AG: I don’t know you anymore. 😛
    Anyway, I use emacs because I found vi to be completely confounding, but to me this is always a matter of personal choice.*
    * Except when it comes to things like students sending me .doc files instead of latex files for our scientific papers. That causes me to blow a gasket.

  6. Justin

    What took you so long? I learned vi back in high school, and it’s all I ever used… :-)
    I like that it has the same syntax as sed, so search and replace operations are incredibly trivial.
    Favorite unix software – vi, awk, and sed are pretty much all I need. My former officemate is quite the perl guru, and xkcd has told us of the wonders of Python. I know nothing of such things myself, though.
    Chris – AFAIK, the word “unix” can be considered a catchall term for old-school unix, Linux, and Mac OSX. Around here at least the latter has become overwhelmingly dominant, since basically all software (other than games, of course) can run on the same machine without rebooting. Seems to me that Apple has largely undercut the rationale for Linux, for those of us who don’t care about open source ideology.
    Mason – how do you feel about .doc for documents other than papers? Last week I submitted a proposal I wrote in Word. :-)

  7. Nick

    I really rather like Visual Studio — I don’t have to think too hard to work out how to do something.
    Mind, there’s one feature that I desperately miss from the Dr. Scheme editor that I’ve not seen elsewhere, a ‘bird’s eye view’. You could have a view open that showed the code with one pixel per character, syntax highlighted, with the normal view’s area background-highlighted. It’s absolutely fantastic if you’re a visual thinker — it makes navigating code immensely easy for me.
    There’s one thing that I’d like to see implemented in an editor that I’ve never come across. I’ve been calling it ‘artificial synesthesia’. I want to have a syntax highlighting that can be quickly and easily adjusted for a special purposes. For example, a search mode where the terms you are looking for get a colored glow and everything else goes to grayscale. Maybe another view to assist flow-control debugging where branches & branching variables get visual emphasis while the body of the code fades to grays.
    Some day, if I’m doing graduate work on user interface design, I’d like to put both of those in an editor.

  8. Lemming

    Nick: That be straight dope, yo. (I’ve had similar ideas, not quite as fanciful tho)
    Funny about hitting esc. I can’t be arsed to remember all of the key combinations in emacs. In addition, I’ve gotten used to using emacs over poorly-supported terminals. The net result is that, for a large number of emacs commands, I start by hitting esc.

  9. Arcane Gazebo

    JSpur: You can actually experience this firsthand: on your MacBook, go to Applications->Utilities and open Terminal. Then type “emacs” or “vim” and hit enter.
    On Unix flavors: at work this means primarily Solaris. (We have some Linux boxes but I haven’t used them much.) At home it’s Mac OS X and Ubuntu. Certainly all modern operating systems.
    Visual Studio: I will be using this sooner or later at work as well, but haven’t had any experience with it yet.
    Other stuff: I learned the basics of awk pretty recently too, but haven’t used sed. We have some huge data files that I’ll process in perl but only after passing them through gawk. I actually like perl–being able to just throw something together without thinking about the details too much is appealing. I haven’t tried python yet but given the rave reviews it gets from some quarters, I’ll probably check it out eventually.

  10. Mason

    Justin: I have occasionally been forced to use .doc files for various applications. I get annoyed when I have to do that. :) I do use MS Word for my CV, although I only send the saved .pdf files.

  11. Lemming

    The usual Perl/Python comparison is apt:
    Perl is like a swiss army knife, and Python is like a well-organized toolbox.
    For a most simple scripting tasks, you can throw together a Perl script in less time (and less text).
    On the other hand… I hate Perl. It’s one of the few languages that having “Linguistics (Computer)” as a class skill doesn’t implicitly give me the ability to read. It’s aggressively and intentionally dense, to the point of making it (to easily) a write-only language.
    Every time I’ve gone back and read an old piece of Python code, I’ve had no trouble understanding what I did. It all just scans.

Comments are closed.