Emacs vs. Vim

Emacs and Vim are the two most widely used text editors on Unix and Unix-like systems. There is a long history of competition between these two text editors, which are vastly more advanced than other text editors on the Unix platform. While both editors feature similar functionality through their plugins, scripting, and shortcut keys, their approaches are slightly different.

Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has over 1,000 editing commands. It also allows the user to combine these commands into macros to automate work.

Vim is a text editor first released by Bram Moolenaar in 1991 for the Amiga computer. The name "Vim" is an acronym for "Vi IMproved" because Vim was created as an extended version of the vi editor, with many additional features designed to be helpful

Contents: Emacs vs Vim

Emacs and Vim User Interface

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.

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

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 "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

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

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 in elisp, while Vim has its own internal scripting language and supports use of other programming languages for plugin development.

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. So 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.

Vim 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. In fact, 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.