As a rule, I try hard not to get sucked into religious wars. You know, Coke vs Pepsi. C++ vs Java. Chrome vs Firefox. There are two I can’t help but jump into: PC vs Mac (although, now that Mac has turned into Unix, that’s almost more habit than anything else) and–the big one–Emacs vs vi.
If you use Linux, Unix, or anything similar, you are probably at least aware of the violence surrounding this argument. Windows users aren’t immune, although fewer of them know the details. If you aren’t familiar with these two programs, they are–in a way–text editors. However, that’s like calling a shopping mall “a store.” Technically, that’s correct, but the connotation is all wrong.
Like most religious wars, this one is partly based on history that might not be as relevant as it used to be. Full disclosure: I’m firmly in the Emacs camp. Many of my friends are fans of vi–I try not to hold it against them. I’ll try to be balanced and fair in my discussion, unless I’m talking about my preference. I don’t have to be fair when it comes to my opinions. Just to be clear: I know how to use vi. My preference isn’t based out of not wanting to learn something new.
The Big Differences
Superficially, there is one big difference between the two editors. Vi has the concept of a mode. Most commands are just ordinary letters (for example, the I key enters insert mode). The problem with that, of course, is that if you start typing in the wrong mode you either get command characters in your file or you issue lots of random commands.
Emacs works more like a normal text editor. When you type normal characters they go into the current file. Commands use special prefix characters like Control+X or Escape. Sure, you might have a normal letter after a prefix (Control+X C, for example) but that’s only for the short duration of the command.
The Case for Vi
The best argument, in my opinion, for vi is that it is fairly lean and it is on just about every Unix-like system you’ll ever encounter. There are other “standard” editors, but they are not screen-oriented and are very painful to use. That’s why I know how to use vi.
You’ll often hear the argument that vi is lean and Emacs is bloated. That’s somewhat true, although modern versions of vi (like vim) are not very skinny, either. Generally, vi starts faster than Emacs, all other things being equal (although you can bog down either one). However, there’s a reason for that, as you’ll see in a minute.
The Case for Emacs
If it were just the fact that Emacs always lets you type plain text, it really would be just a matter of personal preference. However, I have noticed that there are two things people who are passionate about Emacs have in common. First, they are people who either predate widespread use of X11, or that could not use it for one reason or another. Second–and this is a secondary effect–they tend to be touch typists.
The first reason is because Emacs is a text-based window manager. Sure, the most common thing to have in a “window” is a text editor, but Emacs can also display file managers, games, e-mail clients, web browsers, and plenty of other window types. You can even run a shell inside an Emacs window. The most recent version even has a WebKit-based browser. You can watch a YouTube video from within Emacs. If YouTube doesn’t excite you, maybe you’d be more impressed by opening GitHub, Google, or Hackaday.
This leads to the popularity, I think, among touch typists. Being able to create, manipulate, and switch windows without taking your hands off the keyboard is very valuable to fast typists.
Granted, today, you don’t need a text-based windows manager. You could use GNU screen, although it works a little different. But most of us use a GUI desktop now and it is less important to have Emacs manage windows for shells, browsers, and so forth. Even if you want keyboard-driven window management, there are solutions for that too.
If you are a hardcore hacker, Emacs has one other advantage: it is fully programmable using a version of LISP. That’s a dual-edged sword. On one hand, Emacs an do anything. On the other hand, you can go deep down the rabbit hole making custom set ups.
So What’s the Answer?
So maybe it really is a matter of personal preference. But to me, its still Emacs all the way. One thing I’ll point out: It is pretty easy to make Emacs act very much like vi, but the reverse isn’t possible in any meaningful way. Of course, if you are under a certain age, you probably use some GUI editor like sublime or Eclipse and are scratching your head that an editor war even has its own Wikipedia page (not to mention the flurry of comments this post will probably launch).
If you do log into an embedded Linux system that doesn’t have enough horsepower (or connection bandwidth) to support a GUI, both of these editors can help you be more productive. However, Emacs can also give you some measure of multitasking windowing, even over a non-GUI SSH or telnet connection.
Filed under: Hackaday Columns, Interest
No comments:
Post a Comment