Emacs vim

Emacs vs Vim

There have been numerous topics on which fans have shared their views and argued with one another against those opposing their views. These holy wars have been everywhere: iPhone vs. Android, Marvel vs. DC, tabs vs. spaces, etc. A similar discussion over which users, particularly those of the Linux community, tend to get heated has been the Emacs vs. Vim debate, which has been ongoing for decades.

This article dives into this long, ongoing Editor War and makes a decision over which program – Emacs or Vim – takes the edge over the other.

What are Emacs and Vim?

Vim is one of the oldest UNIX-based text editors out there. This text editor is an evolution of vi, a text editor from the early days of UNIX. Vim quickly gained popularity after its introduction, as it not only had almost all the features of vi built into it, but also added some additional functions that made it much more powerful than its predecessor.

The charm of Vim arises from it being extremely lightweight and having an interface with several modes, each with a different, useful purpose. With features like a multi-level undo tree, a huge collection of plugins, powerful text manipulation tools, and support for dozens of programming languages, Vim is rock solid and excels as a text editor.

Emacs, on the other hand, is a cross-platform editor with a non-modal interface. Emacs is quite like Vim, being an old text editor that has been popular for years. Rather than calling it a text editor, however, Emacs is so much more, something like what you would call an operating system. Known for being highly extensible, Emacs is easy to tweak and customize, and allows the implementation of diverse functions and methods, which gives a clear indication of just how powerful this tool can be. Emacs has support for an abundance of packages and extensions, and users can use these to further configure this program, making it even more powerful than before.

With a brief intro on what each editor offers completed, let us now look at some of the features that both Emacs and Vim provide.

1) More than a Text Editor

As text editors, both Emacs and Vim excel at the job that they are meant to do. Both editors contain support for multiple languages, in addition to providing features that bring out the best of a developer. Both of these editors can just about do anything that you can imagine.

The difference between these two arises from the fact that, unlike Vim, Emacs is not just a text editor, but rather has an IDE-like environment. In other words, Emacs is a fully-fledged lisp machine, an interface that offers multiple tools to its users and creates a completely open world, where users can be online 24/7 and live inside the program.

For example, unlike Vim users, who must open the terminal separately to use the program, Emacs comes along with a built-in shell of its own.

Emacs users also have access to features like a web browser, note-taking, and organizing files, as well as multiple games, such as Tetris.

Web Browser:

Org-mode – Organizer:

Tetris:

As seen from the above examples, text editing is just one aspect among the dozen or so features present in Emacs.

2) Customizability

Both Emacs and Vim are known for being extremely customizable and versatile, having an abundance of plugins and extensions to help configure the programs by adding more functionalities.

Emacs takes this one step further by using the lisp programming language. You can implement and redefine almost anything in Emacs by using lisp.

For example, say you want to define a function, which after running, runs Bing in the web browser. This can be easily implemented in Emacs using lisp. To add this feature to Emacs, the following lines of code need to be added to the Emcas initialization file (~/.emacs file):

(defun searcher ()
  (interactive)
  (browse-url
  "https://www.bing.com/"))

For those used to using Vim, Emacs also provides users with packages that allow them to achieve Vim-like behavior inside of Emacs. The most well-known package is Evil mode, which is an extremely powerful Emacs mode that emulates vi completely and also tries to expand on it by adding more compatible and powerful features.

3) User-Friendly Interface

As mentioned above, Vim is a modal editor, meaning it has multiple modes for carrying out different functions. For beginners, this might appear difficult, as switching from one mode to another and learning how to deal with text in each mode can prove quite complicated in the beginning.

Emacs, on the other hand, appears to be more approachable to new users, as it has a non-modal interface and the key bindings do not appear to be that foreign.

 4) Elisp vs Vim Script

Elisp and vim script are the programming languages defined for Emacs and Vim, respectively. These scripts are used for writing functions and plugins to further extend the capabilities of the editors. When comparing these two languages side by side, Elisp outstretches vim by a wide margin. Compared to Elisp, vim script is much more difficult to configure and has very few libraries to work with. Elisp, however, stands at the heart of Emacs and is considered to be powerful enough to implement anything.

Why Emacs is Better than Vim?

Both Emacs and Vim are excellent tools for editing files of all types of programming languages. Both are extremely powerful and provide large sets of tools for their users to work with. However, Emacs not only has the editing tools that Vim has, but also expands on them by providing additional features, such as email client, debugger, etc.

Even with all these features present, Emacs allows you to further customize it and add functionalities to it, which is a fine indication of the power and complexity that exists at the core of Emacs. Being infinitely extendable, Emacs stands head and shoulders above Vim.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn.