You've probably never heard of emacs or Vim, especially if you're just starting out your career in software engineering.
It is also normal that as a windows Operating System user, you've only been working with the notepad, notepad++, sublime text, visual studio code, and all other common text editors.
In the Linux operating system, Emacs and vi are the major editors that are used to manipulate files. Both are the major gladiators in the popular editor wars that started in the late 90s.
Nowadays, the hottest contenders in tech software are web browsers. Internet Explorer, Firefox, and Chrome are competing for a larger market in the figurative browser war.
Holy wars are also existing in every sphere of life, especially in pop culture: iPhone vs Android, Marvel vs DC, Coke vs Pepsi, and so on.
Text Editor Wars
The editor war is the rivalry between users of the Emacs and vi (now usually Vim, or more recently Neovim) text editors. The rivalry has become a lasting part of hacker culture and the free software community.
Since at least 1985, The Emacs versus vi debate was one of the original "holy wars" even before the internet. Many users insisted that their editor of choice is the paragon of editing perfection, and insulting the other. Similar tech battles have been fought over operating systems, programming languages, version control systems, and even source code indent style.
We are going to look at both editors and analyze their features and jargon.
Emacs (Editor Macros) was developed by David A Moon in 1976 making it one of the oldest pieces of software which exists today. GNU Emacs, the most used variant(fork) of Emacs, was released in 1985 by Richard Stallman, the founder of GNU/Linux.
Emacs is a highly advanced, extensible, and customizable text editor that also offers an interpretation of the Lisp programming language at its core. Different extensions can be added to support text editing functionalities.
Emacs has the following features:
- User documentation and tutorials
- Syntax highlighting using colors even for plain text.
- Unicode supports many natural languages.
- Various extensions including mail and news, debugger interface, calendar, and many more.
You can find basic emac commands here
Vim (Vi Improved), as the name suggests is an improved clone of the text editor. The text editor was originally developed by Billy Joy in 1976 for the proprietary Unix operating system. Bram Moolenar later enhanced
vi and released it as
vim in 1991.
Vim is a powerful command-line-based text editor that has enhanced the functionalities of the old Unix Vi text editor. It is one the most popular and widely used text editors among System Administrators and programmers that is why many users often refer to it as a programmer’s editor. It enables syntax highlighting when writing code or editing configuration files.
The UNIX vi editor is a full-screen editor and has two modes of operation:
Command mode commands which cause action to be taken on the file, and
Insert mode in which entered text is inserted into the file. In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the vi editor to enter the insert mode.
In the insert mode, every character typed is added to the text in the file; pressing the (Escape) key turns off the Insert mode.
While there are several vi commands, just a handful of these is usually sufficient for beginning vi users.
You can find basic vi commands here
Vim is also used with Kubernetes for Developer Operations (devops) expecially the Certified Kubernetes Application Developer Exam
Similarities between Emacs and Vi
- The buffer tabs are supported in both the command line and graphical user interface.
- Cross-platform text editors, including Unix, Linux, and Microsoft Windows.
- Available in English, Chinese, French, Italian, Polish, Russian, and even more languages.
Differences between Emacs and Vi
- User Interface and Environment
Vim uses editing modes - most commonly the command mode and insert mode. Vim aims to minimize the number of keystrokes that a user has to press, because vi, upon which Vim is based, was designed to be used over slow terminals.
Emacs uses modifier keys to enable shortcuts, which often involves pressing several keys simultaneously for a single function. This aspect of Emacs is often criticized.
As computer technology developed, new advancements like the GUI (Graphical User Interface) were developed. Emacs adapted and developed its own GUI to make it easier for people to learn and use the editor. In comparison, Vi did not develop its own GUI. This is partly due to the appearance of Vi variants that took over.
A good example is Vi iMproved, also known as Vim, which gradually became more popular than Vi as it added more features and improvements that are not found in Vi. There are also variants of Emacs, but those have not caused the software to fall by the wayside.
- Ease of Learning
Emacs is easier to learn since it has a more natural interface (for users familiar with GUI-based text editors). Since Vim has different editing modes, beginners find it a little harder to learn.
- Productivity and Editing Speed
The main difference between the two is speed. Vi has historically been the faster of the two starting up in less time and is just generally the more responsive of the two.
Vim enthusiasts argue that once a user becomes familiar with the editing modes and commands of Vim, it enables far greater productivity and efficiency. File editing is usually faster with Vim than with Emacs because of Vim's purposely speed-driven interface. For example, cursor movement can be controlled through the H, J, K, and L keys in the normal mode. This means the user's hands do not need to leave the "home row" position, which improves efficiency but comes at the price of adding overhead as mode switching is required to choose between movement and text editing.
In Emacs (with the default configuration), the user moves the cursor with the Ctrl-B or Ctrl-F shortcuts, which might slow down the novice user since two keys need to be pressed. Productivity and efficiency improvements in Emacs depend upon the configuration of the editing environment rather than the editor itself.
- RAM usage of Emacs vs Vim
Vi also takes up much less memory than Emacs; this is at a time when 8MB is considered to be a huge amount of RAM. Vim is lighter than Emacs and uses less memory. Vim advocates criticize Emacs' resource consumption with the tongue-in-cheek suggestion that Emacs stands for "Eighty Megabytes And Constantly Swapping".
However, with GNUclient, a single persistent Emacs process can be run that can support several clients simultaneously. This speeds startup time and decreases total memory usage, closing the gap between Emacs and Vim.
- Extensibility and Customization of Emacs vs Vim
The advantage of Emacs over Vi is its extensive customizability. Emacs lets the user choose from a wide variety of macros to integrate into his workflow and reduce the effort needed in his process.
Vi lacks this level of customizability and relies on its simplistic and straightforward process. Emacs is also capable of emulating Vi in what they call “viper mode”; thereby making it easier for Vi users to use Emacs. Vi, with its simplicity, lacks such capabilities.
While both Vim and Emacs support plugins that enhance their functionality, Emacs supports a lot more customization of the editor environment. This is arguably the most important feature of emacs and is responsible for much of emacs' devoted following.
Emacs can be extended on the fly by redefining built-in elisp functions, either by typing the new definition into Emacs or by loading elisp files. Groups of related changes are called "modes" and can be easily configured to be automatically used for particular types of files (buffers). So it is easy to define modes for different programming languages or frameworks such as "lisp mode" or "Ruby on Rails mode" or "PHP mode". These modes can directly modify even core behaviors of Emacs, automatically format or colorize text and add standard template or "boilerplate" text such as function declarations and closures.
Programmers find Emacs to be far more customizable to their particular requirements than Vim. Yet some programmers may find Vim to ultimately be better suited to their programming environment due to its equally customizable and fully modal operation.
Emacs can be extended in elisp, while Vim has its own internal scripting language and supports the use of other programming languages for plugin development.
While Emacs can be extended in elisp, Vim has its own internal scripting language and supports the use of other programming languages for plugin development can also be extended on the fly by using the command mode. The command mode allows configuration options to be set, functions to be defined, and macros to be made. Configuration files for Vim are just commands that can be input through the command mode.
- Graphical User Interface (GUI)
Both Vim and Emacs have graphical user interfaces. Virtually all menu items on the graphical interface for both editors are simply ways to handle a shortcut command or quick configuration. The GUIs for the editors do not provide virtually any additional functions beyond those available in the CLI (command-line interface)
Emacs uses XDisplay or gtk2 for its GUI. Vim can use many other GUI libraries, such as gtk, gnome, gnome2, motif, athena, and neXtaw, in addition to gtk2.
- Vi is lighter and faster than Emacs.
- Emacs is more customizable than Vi.
- Emacs can emulate Vi but not the other way around.
- Emacs later developed a GUI while Vi did not.
- Emacs continued developing while Vi was succeeded by its variants.
Do we still have a war or a clear winner?
In 2020, Jake King the CEO of CMD decided to settle a long-time debate with his CTO Mike Sample, about which of the two editors is more popular in the Twitter tech space.
.Jake@jakekingWant to settle a long term bet with @mikesample ... Vim or Emacs? Twitter, what do prefer? :wq! #Vim4life23:56 PM - 31 Mar 2020
You should want to make some vim friends right now.
Top comments (2)
emacs has had more users switch to it thanks to its variants(doom and spacemacs)...I use doom because I can vim in it.