Vi vs Emacs

By | April 9, 2020

If you have ever been on the internet at all there is no doubt you’ve come across this flame war at some point. The debate of which is the better Unix text editor, Vi or Emacs. Both of these programs are just about as old as Unix itself and neither is easy to use for beginners. With that said, both are very powerful and are good at what they do as a testament to their longevity.

The Vi editor is installed by default on just about every Unix based system and Emacs is almost always made available as well. One thing both editor have in common is how they have polarized their users. The editors take some investment to learn. It’s understandable how users would stick to one editor or the other and are not keen to invest in both. Although both are text editors, they are very different so I’m going to go over each editor to bring some perspective to this debate.

Vi – The Visual Editor

vim_editor.png For the uninitiated, Vi is an un-intuitive nightmare that makes no sense at all. When you open a new or empty file with the default Vi on FreeBSD you get an almost blank console. If you just start typing all hell breaks loose. Despite all this, it has been and still is a default editor on just about every Unix based system out there.

To get an understanding how Vi works you first have to understand it has several modes. The initial mode is the COMMAND mode. This is where the keys you type execute various commands instead of inserting characters into the document, for example; x – deletes a character, j – move down a line, :w – write to the file and :q – quit the editor. The ‘i’ key will switch to the INSERT mode where now you can type characters into the document as you expected in the first place. The ESC key will switch you back to COMMAND mode.

The power Vi is the ability for commands to be combined together to make editing easy with very few key strokes. It’s light weight with one purpose in mind, editing a file. Only in its relative recent history, can you open and edit more than file at a time.

Emacs – Editing Macros

Emacs-logo.png The Emacs editor, also cheekily known as the Escape-Alt-Meta-Control Sequence editor, shouldn’t be considered just a text editor. Although this is the main purpose of the program, it’s more along the lines of a lisp interpreter with a text editor as a front end. Most people think of this the other way around, a text editor extended by lisp, and this is wrong in my opinion. Just about every key you type executes a lisp command that can be reassigned. This means emacs can be used for so much more than just editing files. Actually it can do just about anything, email, games, terminal, debugging and so much more.

Emacs is the clear winner, right? Well it’s not so simple, with features comes software bloat and when you start using all these features Emacs becomes quite a heavy weight. It’s takes some experience be able to use its features and keep the startup times down and running fairly lean. Not to mention how much there is to learn. After 20 years of using Emacs, I’m still learning about all the features it has to offer.

So Who’s Winning the Editor War?

So who’s winning… neither editor! It’s like comparing apples with oranges. Although they are both technically text editors that’s where the similarities end. They both function very differently with different project goals in mind. If you had to decide which one to learn it all depends on your needs and both are worth learning.

Stay away from the flame wars. If someone tells you that one editor is flat out better than the other, they are wrong. If someone tells you never to use one of the editors, they are wrong. I wouldn’t trust the opinion of anyone that trashes on one or the other. Listen to the pro and cons for each editor. As mentioned before, ultimately which is the best choice for you is up to you and your needs.

For myself, I use Emacs for everything. All the articles and pages on this website are written in Emacs using org-mode. I also use it to check emails, programming, watch my system logs, task lists and so on. It can be a complete desktop in itself. I do use Vi usually for editing system configuration files and simple edits.

There are also several projects that are attempting to solve this debate by creating their own console text editors. So Vi and Emacs aren’t your only options. In the end, live in peace and you do you… or is that just to cheesy 😉

One thought on “Vi vs Emacs

  1. Pingback: Emacs and Vi(m) | Irreal

Comments are closed.