Hacker Newsnew | comments | show | ask | jobs | submitlogin

I used vi (vim) for about five years, before switching to emacs (gnu emacs), which I've used for about two. They're both excellent text editors, but are clearly optimized for different things, and have tremendous differences in interface, extensibility, and culture.

The big advantage for Emacs lies in being a sort of Lisp virtual machine. It's extensible enough to be nearly an OS in its own right (certainly a "desktop environment" or whatever), and has decades of extensions already available for it. Where vi(m) has two fundamental modes (with replace being a submode of insert, I suppose), emacs has modes specific to most tasks -- if you want a mode that integrates with an external Common Lisp (slime), OCaml (tuareg), or Ruby (ruby-mode), it's there. This doesn't just mean syntax highlighting and indenting, it means more abstract things like being able to insert the type signature for a Haskell function under the cursor, jump to the definition of an object's superclass, or check/edit/archive your email. (For a really good example, check out this screencast of Marco Baringer using Slime: http://common-lisp.net/~mbaringer/slime.torrent ) Emacs Lisp is not the greatest as Lisp implementations / dialects go, but it has a lot of advantages for extending an editor compared to something like Python or Perl. (I have a suspicion Smalltalk or Forth would work well, though.)

I know that vim is extensible, but typically you process a region by typing :%!some_cmd to pipe it back and forth; most integration between vim and external programs that I've observed has been at the level of piping text (in the quintessentially Unixy way). This loses a lot of deeper context that could better tie things together.

The main strength of vi, I think, is in its ubiquity. While I use emacs to do most things, I also have a heavily customized environment that I carry around with me. (It's under version control, etc.) I can be extremely productive with it, once I've moved in, but vi is available everywhere. I'm talking about a basic vi (nvi?) with one level of undo and no syntax highlighting, perhaps, but it's still pretty good for editing text, particularly if you're a touch-typist and the interface has become second nature. It edits text. It doesn't tie things together into one harmonious environment, but it edits text, and it's really efficient once you know it.

For what its worth, there's an editor called "mg" which has the default emacs keyboard config out of the box, but is not really very programmable. While I'm very familiar with the basic keyboard controls, it feels crippled to me. I use it while doing computer setup stuff, because it's in the default OpenBSD install, and it's a decent pager, but it's really not the same.

Anyway, that's my experience with each. Emacs seems far more powerful in the long run, but it takes quite a bit more time to learn to use it to anywhere near its full capacity, and doing so will rely on carrying around your configuration. (It also has a relatively alien culture and vocabulary, which takes some getting used to.) Vi does what it does everywhere, but cannot grow indefinitely to fit your needs. It's focused on just being a good text editor, rather than a full environment. If you're talking years, though, I would definitely give emacs a shot.

(Incidentally, I think emacs is quite reasonable under the Dvorak keyboard layout (better than qwerty, I think), while vi feels far more awkward. The hjkl keys get scattered badly, for one thing. That, a growing fascination with Lisp, and being utterly blown away by the Slime screencast were why I ultimately switched.)




An addendum, a couple months later:

Another major difference is that Emacs frequently uses modifier keys, and it is especially common to type with Control held down (while navigating). If you use Emacs, you will probably benefit from moving Control to either CapsLock (home row, pinky) or the left Alt (to hit it with your thumb); bending your pinky down to Control at the bottom of the keyboard while typing contorts your hand rather badly.

On the other hand, Vi seldom uses modifier keys besides Escape (which could also be moved to CapsLock), and it is never held down while typing. While I don't know of any hard data, the default Emacs configuration is almost certainly harder on your hands in an RSI sense.

Wily (a clone of plan9's Acme: http://www.cse.yorku.ca/~oz/wily/index.html) is another extremely powerful editor, though I don't personally like its mouse-centric design. Still, it's quite extensible, and probably worth a look.

-----


Thanks. That was probably the first time I have heard an honest comparison of the two editors (well, honest-seeming at least ;-P), although I've been looking for one for a while. Also, I think you just got me to give Emacs a try. Hopefully I'll still be able to switch into Vim-mode at need (heh, so now my life is modal too... Curse you, Vim, you have invaded my soul!) Anyway, thanks.

-----


There's viper-mode to emulate vi, but the first real roadblock is probably learning how to explain to the built-in help system what you're trying to figure out.

C-h t (that's Control-h, let go of control, t) will open up a thorough tutorial. Also, http://emacswiki.org has a lot of info at all levels of expertise.

-----


The torrent for the Slime screencast has no seeders. The video is also available here:

http://www.guba.com/watch/3000054867

-----


Thanks! I checked in a couple of the usual places and they were 404. It was already time for bed ... :)

-----




Applications are open for YC Summer 2015

Guidelines | FAQ | Support | API | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: