Vi vs. Emacs

After many people flaming me and telling me that vi is better, etc etc, blah, blah, blah, I have finally come to my final resting place on the vi vs emacs debate. 

The problem is simple: consistency

No, not consistency there. Not there either. Think simple.

Emacs is consistent with every text entry method I have used except vi.

Almost every text entry system uses the same type of interface, with very few exceptions:
1. You move your cursor
2. You type
3. You move your cursor.

Think about it, the text box that you will reply and flame me with, is it closer to vi or emacs?
Microsoft word, bash, Eudora preferences text fields, dos games that are 20 years old, the google search bar, IE's URL bar, Renaming a file, and just about everything else you can think of where text needs to be edited, the three steps are true.

Now, is emacs a huge bloated piece of software? Yes. Is that a good enough reason to not install it? Sure, if you are the only one to use it, or if resources are really tight. Does emacs *need* a browser built in? Absolutely not. 

To vi's credit, it is small and fast for those who have gotten past the fumbling.It is installed on nearly every unix/linux available, so if youlike vi, it will always be available to use, but it doesn't need to be complicated just to be 1337, and honestly, thats what it feels like when people bash me for not using it. "You're not good enough to learn vi, so stfu". You know what? That is the same attitude that turns people away from technology, weather it is Linux, computers, or product X. Your job as a computer <fill in the blank> is to realize that not everyone else needs to know everything you do, and that can start with the editor.

SO, when I open a file in emacs, I can use my arrow keys, and start typing, and then use the arrow keys again.

Just like everything else I have ever used on a computer. That is, except vi.

<edit>I suppose this is more "why I don't like vi" instead of "vi vs emacs"</edit>


Emacs is way better than vi or vim at REPLs. If you have a language that supports a REPL then you'll find that emacs has built in, far superior REPL integration and support.

REPL THIS: say what? Basically you are saying the emacs keybindings are better than the vi keybindings for repl. This is not the same discussion as using emacs or vi to edit files, besides, the only POSIXly required editing mode for something like /bin/sh is vi (though that is mostly due to RMS's unwillingness to let the emacs keybindings be used), and readline lets you use the vi keybindings in any REPL that used libreadline.

Also, there are plugins for browsers and editors that let you use vi keys instead of their defaults (which are usually not emacs keys).

If all you want to do is move the cursor and type, why use emacs or vi? Just use one of the many simple fast editors.

vi and emacs are power tools. If you don't want to use those features, don't use them.

Consistency is great, but there are a lot of other factors to consider. I can get a lot done very quickly in vim. Works for me.

The distance from vi to the behaviour you describe is a simple "i". Enter vi/vim, press "i" and you're in the same "move-write-move" mood - at least in a recent-enough system where arrow keys are supported. Is that initial "i" that really bugs you? You still save a keystroke ;-)

To tell the whole story, every other editor/text area/whatever has something "additional" to do things. In the google search bar, when you press enter it does not really put a newline character - it sends the query (thanks to the browser). Something along these lines can be told for every other thing you mentioned. This is why emacs is full of C-this and M-that and C-M-foobarbaz, while vi decided to have an entirely separated mode to give you the possibility to enter commands that are not "simply write this in the window".

Continue to use emacs if you feel at home. I switched from emacs to vi some years ago, never regretted but everyone is different. For a professional, anyway, the argument about attitudes driving away from technology does not hold - one should be prepared to use vi if the work requires it. Also, I wouldn't mind childish comments about "not being good enough to do learn vi" - the best reply that comes to mind is "good idea! Let's all stfu and show some code!"

Flavio, you are correct, that pressing 'i' will do what you say on *most* systems, but there are system/shell combinations where if you press, i and then an arrow key, you muck up your text file with ^[21F
(not everyone has the luxury of setting their operating env)

Now you either need to remember to press esc and then press 'u' a bunch of times, assuming the non-vi user even knows about 'u', and put your file back together, else (and I've seen this a lot), they try putting the file back together by editing out the garbage that was put in, and inevitably, they use an arrow key when in insert mode, and do it all over again. This is painful to watch, painful to go through, and the ui problems are solved by simply typing 'emacs '.

Emacs is better for the beginner novice programmer too because of its auto indent. Nothing bothers me more than a left justified file:
while($something {

I don't really care what anyone else uses, I just hate watching other people stumble.

I suspect a major point of argument here may be vi-vs-emacs, or vim-vs-emacs.

vi is a decades old rather small text editor, not that useful for modern programming development. vim is a vi-like editor full of useful features. Such as, actually understanding the arrow keys. And syntax highlight, auto indentation (Anonymous above, take note), intelligent completion that actually understands Perl (or whatever),...

I'm a heavy vim user, and I dislike vi. I use vim mostly in insert mode; I use the arrow keys, the Home/End/etc.. keys... I move around a lot in insert mode, and am generally quite productive with it. Please don't lump us all in the same boat.

Some very interesting points you've made; I like vi for all of the very same reasons that you don't like it. Sometimes I just need something different...

About this Entry

This page contains a single entry by leonard published on October 11, 2010 11:33 PM.

Paperman! was the previous entry in this blog.

Tools every Perl developer should use. is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.