Editor war

Editor war is the common name for the rivalry between users of the Emacs and vi (Vim) text editors. The rivalry has become a lasting part of hacker culture and the free software community.

The Emacs vs vi debate was one of the original "holy wars" conducted on Usenet groups,[1] with many flame wars fought between those insisting that their editor of choice is the paragon of editing perfection, and insulting the other, since at least 1985.[2] Related battles have been fought over operating systems, programming languages, version control systems, and even source code indent style.[3][4][5] Notably, unlike other wars (ie, UNIX vs ITS vs VMS, C vs Pascal vs Fortran), the editor war has yet to be resolved with a clear winner, and the hacker community remains split roughly 50/50.[2]

Differences between vi and Emacs

The most important differences between vi and Emacs are presented in the following table:

vi Emacs
Keystroke execution vi retains each permutation of typed keys. This creates a path in the decision tree which unambiguously identifies any command. Emacs commands are key combinations for which modifier keys are held down while other keys are pressed; a command gets executed once completely typed. This still forms a decision tree of commands, but not one of individual keystrokes. A vim-inspired Emacs package (undo-tree) provides a user interface to the tree.[6]
Memory usage and customizability vi is a smaller and faster program, but with less capacity for customization. The vim version of vi has evolved to provide significantly more functionality and customization than vi, making it comparable to Emacs[notes 1]. vi start-up time is near instantaneous for small text files, while vim is almost as fast. Emacs executes many actions on startup, many of which may execute arbitrary user code.[9] This makes Emacs take longer to start up (even compared to vim) and require more memory. However, it is highly customizable and includes a large number of features, as it is essentially an execution environment for a Lisp program designed for text-editing. Emacs 18 (released in 1987) introduced a server mode[10] designed to run continuously in the background. Various instances of Emacs can then be started in client mode, attaching to this server and sharing state. Emacsclient startup time is practically instantaneous as all it does is provoke the existing Emacs process to redraw the display.
User environment vi was originally exclusively used inside of a text-mode console, offering no graphical user interface (GUI). Most modern vi derivatives, e.g. MacVim and gVim, include GUIs. However, support for proportionally spaced fonts remains absent. Also lacking is support for different sized fonts in the same document.[11] Emacs, while also initially designed for use on a console, grew a TUI fairly early on due to its Lisp machine heritage. X11 GUI support was added in Emacs 18, and made the default in version 19. Current Emacs GUIs include full support for proportionate spacing and font-size variation. Emacs also supports embedded images and hypertext.
Function/navigation interface vi uses distinct editing modes. Under "insert mode", keys insert characters into the document. Under "normal mode" (also known as "command mode"), bare keypresses execute vi commands. Emacs uses metakey chords.[notes 2] Keys or key chords can be defined as prefix keys, which put Emacs into a mode where it waits for additional key presses that constitute a key binding. Key bindings can be mode-specific, further customizing the interaction style. Emacs provides a command line accessed by M-x that can be configured to autocomplete in various ways. Emacs also provides a defalias macro, allowing alternate names for commands.
Keyboard vi uses no <Alt> key and seldom uses the <Ctrl> key. vi's keyset is mainly restricted to the alphanumeric keys, and the escape key. This is an enduring relic of its teletype heritage, but has the effect of making most of vi's functionality accessible without frequent awkward finger reaches. The expansion of one of Emacs' backronyms is Escape, Meta, Alt, Control, Shift, which neatly summarizes most of the modifier keys it uses, only leaving out Super. Emacs was developed on Lisp Machines with Space-cadet keyboards that were more ergonomic with respect to modifiers than modern layouts. There are multiple emacs packages, such as spacemacs[13] or ergoemacs[14] that replace these key combinations with ones easier to type, or customization can be done ad hoc by the user.
Language and script support vi has rudimentary support for languages other than English. Vim is partially multilingual, with support for European, Arabic, Hebrew, and Far East Asian language support only. Notably, Indic language and script support is absent. Emacs has full support for all Unicode-compatible writing systems and allows multiple scripts to be freely intermixed.[15]

Benefits of Emacs

Benefits of vi-like editors

Humor

Richard Stallman appearing as St IGNU−cius, a saint in the Church of Emacs

Frequently, at some point in the discussion, someone will point out that ed is the standard text editor.[23]

The Church of Emacs,[24] formed by Emacs and the GNU Project's creator Richard Stallman, is a parody religion.[25] While it refers to vi as the "editor of the beast" (vi-vi-vi being 6-6-6 in Roman numerals), it does not oppose the use of vi; rather, it calls proprietary software anathema. ("Using a free version of vi is not a sin but a penance."[26]) The Church of Emacs has its own newsgroup, alt.religion.emacs, that has posts purporting to support this belief system.

Stallman has referred to himself as St IGNU−cius, a saint in the Church of Emacs.[27]

Supporters of vi have created an opposing Cult of vi, argued by the more hardline Emacs users to be an attempt to "ape their betters".

Regarding vi's modal nature (a point of extreme frustration for new users)[28] some Emacs users joke that vi has two modes – "beep repeatedly" and "break everything". vi users enjoy joking that Emacs's key-sequences induce carpal tunnel syndrome, or mentioning one of many satirical expansions of the acronym EMACS, such as "Escape Meta Alt Control Shift" (a jab at Emacs's reliance on modifier keys).[29] or "Eight Megabytes And Constantly Swapping" (in a time when that was a great amount of memory) or "EMACS Makes Any Computer Slow" (a recursive acronym like those Stallman uses) or "Eventually Munches All Computer Storage", in reference to Emacs's high system resource requirements. GNU EMACS has been expanded to "Generally Not Used, Except by Middle-Aged Computer Scientists" referencing its most ardent fans, and its declining usage among younger programmers compared to more graphically-oriented editors such as TextMate or Sublime Text. The Emacs distribution includes the full list.[30]

As a poke at Emacs' creeping featurism, vi advocates have been known to describe Emacs as "a great operating system, lacking only a decent editor". Emacs advocates have been known to respond that the editor is actually very good, but the operating system could use improvement (referring to Emacs' famous lack of concurrency.)

A game among UNIX users, either to test the depth of an Emacs user's understanding of the editor or to poke fun at the complexity of Emacs, involved predicting what would happen if a user held down a modifier key (such as Control or Alt) and typed their own name. A similar "game" was reportedly played[31] among users of the old TECO editor, in which lay the roots of Emacs.

Due to the unintuitive character sequence to exit vi (":qa!"), hackers joke that there is a proposed method of creating a pseudorandom character sequence by having a user unfamiliar with vi seated in front of an open editor and asking them to exit the program.

Today

In the past, many small editors modeled after or derived from vi flourished. This was due to the importance of conserving memory with the comparatively minuscule amount available at the time. As computers have become more powerful, many vi clones, Vim in particular, have grown in size and code complexity. These vi variants of today, as with the old lightweight Emacs variants, tend to have many of the perceived benefits and drawbacks of the opposing side. For example, Vim without any extensions requires about ten times the disk space required by vi, and recent versions of Vim can have more extensions and run slower than Emacs. In The Art of Unix Programming, Eric S. Raymond called Vim's supposed light weight when compared with Emacs "a shared myth."[32] Moreover, with the large amounts of RAM in modern computers, both Emacs and vi are lightweight compared to large integrated development environments such as Eclipse, which tend to draw derision from Emacs and vi users alike.

Tim O'Reilly said, in 1999, that O'Reilly Media's tutorial on vi sells twice as many copies as that on Emacs (but noted that Emacs came with a free manual).[33] Many programmers use either Emacs and vi or their various offshoots, including Linus Torvalds who uses MicroEMACS.[34] Also in 1999, vi creator Bill Joy said that vi was "written for a world that doesn't exist anymore" and stated that Emacs was written on much more capable machines with faster displays so they could have "funny commands with the screen shimmering and all that, and meanwhile, I'm sitting at home in sort of World War II surplus housing at Berkeley with a modem and a terminal that can just barely get the cursor off the bottom line."[35][36]

In addition to Emacs and vi workalikes, pico and its free and open source clone nano and other text editors such as ne often have their own third-party advocates in the editor wars, though not to the extent of Emacs and vi.

As of 2014, both Emacs and vi can lay claim to being among the longest-lived application programs of all time,[37] as well as being the two most commonly used text editors on Linux and Unix.[38] Many operating systems, especially Linux and BSD derivatives, bundle multiple text editors with the operating system to cater to user demand. For example, a default installation of OS X contains Emacs, ed, nano, TextEdit, and Vim.

See also

Notes

  1. As of 2013, vim has 1731 kLOC of code (1142 in C + 506 stock distro vimScript + 83 makefile-related), whereas GNU Emacs has 1623 (just 299 in C + 1270 stock distro Emacs Lisp + 54 makefile-related).[7][8] There are many optional Emacs Lisp (and Vimscript) packages available; the numbers here refer to only code which is actually included in the main download of the respective editor.
  2. Emacs also has something called "modes"; however, in Emacs these generally refer to long-term interaction states that apply for entire time one works with a given file or dataset, and do not imply a modal interface per se.[12]

References

  1. Holy War (Hacker Jargon)
  2. 1 2 EMACS vs. vi: The endless geek 'holy war'
  3. "Just Let Me Code".
  4. "Why Coding Style Matters".
  5. "Never use hard tabs". Reasons not to use hard tabs
      Due to legacy, different text editors treat hard tabs different. UNIX text editors prefer hard tab is 8 spaces, Windows text editors and IDEs (Eclipse) prefer that a hard tab is 4 spaces.
      The hard tab length agreement between different text editors cannot be reached
      The hard tab length agreement between people cannot be reached
      Thus, hard tabs may break source code readability and editability if there is more than a single person editing the file. They will open the file in an editor with different tab settings, edit it and next time you open the file it is ruined and all indentations are wrong.
      This is even worse on white space sensitive languages (Python, CoffeeScript) as this might actually cause syntax errors or programming logic errors
    However, you can avoid this problem in the first place if you do indentation using soft tabs (spaces) instead.
    Even if you were the single person in the world editing the text file, even you might switch the text editor in some point and accidentally shoot yourself in the leg.
  6. "undo-tree-readme.txt". The only downside to this more advanced yet simpler undo system is that it was inspired by Vim. But, after all, most successful religions steal the best ideas from their competitors!
  7. "The GNU Emacs Open Source Project on Open Hub : Languages Page". Ohloh.net. Retrieved 1 December 2014.
  8. "The Vim Open Source Project on Open Hub : Languages Page". Ohloh.net. Retrieved 1 December 2014.
  9. "Startup Summary".
  10. "NEWS.18". Programs such as mailers that invoke "the editor" as an inferior to edit some text can now be told to use an existing Emacs process instead of creating a new editor.
  11. "syntax.txt". All fonts used, except for Menu and Tooltip, should be of the same character size as the default font! Otherwise redrawing problems will occur.
  12. "EmacsWiki: Category Modes". Emacswiki.org. Retrieved 1 December 2014.
  13. "spacemacs".
  14. "Ergoemacs".
  15. "International Chars". Internally, Emacs uses its own multibyte character encoding, which is a superset of the Unicode standard. This internal encoding allows characters from almost every known script to be intermixed in a single buffer or string. Emacs translates between the multibyte character encoding and various other coding systems when reading and writing files, and when exchanging data with subprocesses.
  16. "Carbon Emacs Package". Retrieved 2006-09-27.
  17. "Aquamacs is an easy-to-use, Mac-style Emacs for Mac OS X". Retrieved 2006-09-27.
  18. B, Ramprasad (2005-06-24). "GNU Emacs FAQ For Windows 95/98/ME/NT/XP and 2000". Retrieved 2006-09-27.
  19. Borgman, Lennart (2006). "EmacsW32 Home Page". Retrieved 2006-09-27.
  20. "GNU Emacs on Windows". Franz Inc. 2006. Retrieved 2006-09-27.
  21. "Evil - Home - Open wiki". gitorious.org. May 29, 2014. Archived from the original on September 16, 2014. Retrieved September 16, 2014.
  22. Kozlowski, Mike. "Why Atom Can't Replace Vim". Retrieved 7 May 2014.
  23. "Ed, man! !man ed". Gnu.org. Retrieved 1 December 2014.
  24. "Rules, Sins, Virtues, Gods and more of The Church of Emacs". Gnu.org. Retrieved 1 December 2014.
  25. "Saint IGNUcius - Richard Stallman". Stallman.org. Retrieved 1 December 2014.
  26. "The unabridged selective transcript of Richard M Stallman's talk at the ANU". Linuxhelp.blogspot.com. Retrieved 1 December 2014.
  27. "Saint IGNUcius - Richard Stallman". Stallman.org. Retrieved 1 December 2014.
  28. vi (Hacker Jargon)
  29. "satirical expansions of EMACS". Gnu.org. Retrieved 1 December 2014.
  30. Eric S. Raymond (2004). The art of Unix programming. Addison-Wesley Professional. p. 343. ISBN 978-0-13-142901-7. Retrieved 17 December 2011.
  31. "Real Programmers Don't Use PASCAL". Datamation: 263–265. July 1983.
  32. "The Right Size for an Editor". Catb.org. Retrieved 1 December 2014.
  33. "Editor: vi or emacs?". Oreilly.com. 21 June 1999. Retrieved 1 December 2014.
  34. Jarosław Rzeszótko. "Stifflog: Stiff asks, great programmers answer". Stifflog.com. Archived from the original on 8 November 2006. Retrieved 1 December 2014.
  35. Vance, Ashlee (September 11, 2003). "Bill Joy's greatest gift to man – the vi editor". theregister.co.uk. Archived from the original on June 3, 2014. Retrieved June 3, 2014.
  36. Joy, Bill (November 1999). "The Joy of Unix: Sun Microsystems Co-Founder Bill Joy Charts Where Linux and Free Software Fit Into His Company's Solar System.". Linux Magazine (Interview). Interview with Eugene Eric Kim. Archived from the original on February 7, 2003. Retrieved June 3, 2014.
  37. "The Oldest Rivalry in Computing". two rival programs can stake a claim to being among the longest-lived applications of all time. Both programs are about to enter their fifth decades. Both programs are text editors, for inputting and editing code, data files, raw HTML Web pages, and anything else. And they are mortal enemies.
  38. "Choosing an Editor". these two editors express sharply contrasting design philosophies, but both are extremely popular and command great loyalty from identifiable core user populations. Surveys of Unix programmers consistently indicate about a 50/50 split between them, with all other editors barely registering.

External links

This article is issued from Wikipedia - version of the 12/2/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.