Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vi (text editor)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Keyboard-oriented text editor}} {{Use dmy dates|date=March 2021}} {{Lowercase title}} {{Infobox software | name = vi | logo = | screenshot = NetBSD 6.1 vi C Hello World.png | caption = vi editing a [[Hello World program]] in [[C (programming language)|C]]. Tildes signify lines not present in the file. | developer = [[Bill Joy]] | released = {{Start date and age|df=yes|1976}} | latest release version = | latest release date = | latest preview version = | latest preview date = | operating system = [[Unix]], [[Unix-like]] | platform = [[Cross-platform]] | programming language = [[C (programming language)|C]] | genre = [[Text editor]] | license = [[BSD licenses|BSD-4-Clause]] or [[Common Development and Distribution License|CDDL]] | website = }} '''vi''' (pronounced as two letters, {{IPAc-en|ˌ|v|iː|ˈ|aɪ|audio=en-us-vi.oga}})<ref>{{citation |author=Computerphile |title=EXTRA BITS GREP from ED and Text Editors - Computerphile – Computerphile |date=2018-07-09 |url=https://www.youtube.com/watch?v=bSaBe6WiC2s&list=PLzH6n4zXuckqZ90zLyy36qjO5YIn1RulG |access-date=2020-04-17 |url-status=live |archive-url=https://ghostarchive.org/varchive/youtube/20211118/bSaBe6WiC2s |archive-date=2021-11-18}}{{cbignore}}</ref> is a screen-oriented [[text editor]] originally created for the [[Unix]] operating system. The portable subset of the behavior of vi and programs based on it, and the [[ex (text editor)|ex]] editor language supported within these programs, is described by (and thus standardized by) the [[Single Unix Specification]] and [[POSIX]].<ref>{{cite web |title="vi — screen-oriented (visual) display editor", The Open Group Base Specifications Issue 7; IEEE Std 1003.1, 2013 Edition |author1=The IEEE |author2=The Open Group |name-list-style=amp |year=2013 |url=https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html |access-date=2013-07-15}}</ref> The original code for vi was written by [[Bill Joy]] in 1976 as the visual [[mode (user interface)|mode]] for the ex [[line editor]] that Joy had written with Chuck Haley.<ref name="interview">{{cite web |title=Interview with Bill Joy |url=http://web.cecs.pdx.edu/~kirkenda/joy84.html |access-date=2017-06-03 |url-status=dead |archive-url=https://web.archive.org/web/20120210184000/http://web.cecs.pdx.edu/~kirkenda/joy84.html |archive-date=10 February 2012}}</ref> Joy's ex 1.1 was released as part of the first [[Berkeley Software Distribution]] (BSD) Unix release in March 1978. It was not until version 2.0 of ex, released as part of Second BSD in May 1979 that the editor was installed under the name "vi" (which took users straight into ex's visual mode),<ref>{{cite web |title=Second Berkeley Software Distribution Manual |website=roguel ife.org |url=http://roguelife.org/~fujita/COOKIES/HISTORY/2BSD/ |access-date=27 March 2018}}</ref> and the name by which it is known today. Some current implementations of vi can trace their source code ancestry to Bill Joy; others are completely new, largely compatible reimplementations.{{Citation needed|date=June 2020}}{{discuss|traceable to Bill Joy?}} The name "vi" is derived from the shortest unambiguous abbreviation for the ex command <kbd>visual</kbd>, which switches the ex [[line editor]] to its full-screen mode. In addition to various non–[[free software]] variants of vi distributed with proprietary implementations of Unix, vi was opensourced with [[OpenSolaris]], and several [[free and open source software]] vi clones exist. A 2009 survey of ''[[Linux Journal]]'' readers found that vi was the most widely used text editor among respondents, beating [[gedit]], the second most widely used editor, by nearly a factor of two (36% to 19%).<ref>{{cite journal |title=Readers' Choice Awards 2009 |last=Gray |first=James |journal=[[Linux Journal]] |date=1 June 2009 |url=https://www.linuxjournal.com/article/10451 |access-date=2010-01-22}}</ref> ==History== ===Creation=== [[File:Bill Joy at World Economic Forum (Davos), 2003-01 (cropped).jpg|thumb|[[Bill Joy]], the original creator of the vi editor in 2003]] vi was derived from a sequence of UNIX command line editors, starting with [[Ed (text editor)|ed]], which was a line editor designed to work well on [[teleprinter]]s, rather than [[computer terminal|display terminals]]. Within [[AT&T Corporation]], where ed originated, people seemed to be happy with an editor as basic and unfriendly as ed, [[George Coulouris (computer scientist)|George Coulouris]] recalls:<ref name=coulouris/> <blockquote> [...] for many years, they had no suitable terminals. They carried on with [[teleprinter|TTY]]s and other printing terminals for a long time, and when they did buy screens for everyone, they got [[Tektronix 4014]]s. These were large [[direct-view bistable storage tube|storage tube]] displays. You can't run a screen editor on a storage-tube display as the picture can't be updated. Thus it had to fall to someone else to pioneer screen editing for Unix, and that was us initially, and we continued to do so for many years. </blockquote> Coulouris considered the cryptic commands of ed to be only suitable for "immortals", and thus in February 1976, he enhanced ed (using Ken Thompson's ed source as a starting point) to make em (the "editor for mortals"<ref name="em-source">{{cite web |title=Source code for em |date=February 1976 |work=coulouris.net |url=https://www.coulouris.net/cs_history/em_story/emsource/}}</ref>) while acting as a lecturer at [[Queen Mary, University of London|Queen Mary College]].<ref name=coulouris>''A Quarter Century of UNIX'', by Peter H. Salus, Addison-Wesley 1994, pages 139–142. [https://www.coulouris.net/cs_history/em_story/ (excerpt available online)]</ref> The em editor was designed for display terminals and was a single-line-at-a-time visual editor. It was one of the first programs on Unix to make heavy use of "raw terminal input mode", in which the running program, rather than the terminal device driver, handled all keystrokes. When Coulouris visited [[University of California, Berkeley|UC Berkeley]] in the summer of 1976, he brought a [[DECtape]] containing em, and showed the editor to various people. Some people considered this new kind of editor to be a potential resource hog, but others, including [[Bill Joy]], were impressed.<ref name=coulouris/> Inspired by em, and by their own tweaks to ed,<ref name="interview"/> [[Bill Joy]] and Chuck Haley, both graduate students at [[University of California, Berkeley|UC Berkeley]], took code from em to make en,<ref name="interview"/><ref name=register>{{cite web |last=Vance |first=Ashlee |author-link=Ashlee Vance |title=Bill Joy's greatest gift to man – the vi editor |work=[[The Register]] |date=11 September 2003 |url=https://www.theregister.co.uk/2003/09/11/bill_joys_greatest_gift/ |access-date=2012-06-30 |url-status=dead |archive-url=https://web.archive.org/web/20120513104857/http://www.theregister.co.uk/2003/09/11/bill_joys_greatest_gift/ |archive-date=13 May 2012}}</ref> and then "extended" en to create [[Ex (text editor)|ex]] version 0.1.<ref name="interview"/> After Haley's departure, Bruce Englar encouraged Joy to redesign the editor,<ref name="ex-Acks-bsd4.4">{{cite manual |title=ex Reference Manual |series=4.4 BSD (encumbered, not Lite) |last=Joy |first=Bill |publisher=CSRG, UC Berkeley |format=roff source |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/usr.bin/ex/USD.doc/ex/ex.rm}} (see Acknowledgments section at end of file)</ref> which he did June through October 1977 adding a full-screen visual mode to ex<ref name="ex-date">{{cite web |title=See dates in copyright headers, ex 1.1 source code |work=minnie.tuhs.org |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/ex-1.1}}</ref>{{emdash}}which came to be vi.<ref name="begriff">{{cite web |title=History and effective use of Vim |website=begriffs.com |url=https://begriffs.com/posts/2019-07-19-history-use-vim.html#history |access-date=2021-08-27}}</ref> vi and ex share their code; vi is the ex [[executable|binary]] launching with the capability to render the text being edited onto a [[computer terminal]]{{emdash}}it is ex's visual mode.<ref name="begriff"/> The name ''vi'' comes from the abbreviated ex command (<code>vi</code>) to enter the visual mode from within it. The longform command to do the same was <code>visual</code>,<ref name="begriff"/><ref name="exman">{{cite manual |last=Joy |first=William N. |author-link=Bill Joy |orig-date=November 1977 |title=Ex Reference Manual Version 1.1 |date=November 1977 |chapter=Command summary |location=Berkeley, CA |page=8 |url=https://begriffs.com/pdf/ex-manual.pdf |url-status=live |archive-url=https://web.archive.org/web/20200414143456/https://begriffs.com/pdf/ex-manual.pdf |archive-date=14 April 2020}}</ref> and the name ''vi'' is explained as a contraction of ''visual'' in later literature. <code>vi</code> is also the [[command (computing)|shell command]] to launch ex/vi in the visual mode directly, from within a [[shell (computing)|shell]].<ref name="begriff"/> According to Joy, many of the ideas in this visual mode were taken from [[Bravo (editor)|Bravo]]{{emdash}}the bimodal text editor developed at [[Xerox PARC]] for the [[Xerox Alto|Alto]]. In an interview about vi's origins, Joy said:<ref name="interview"/> <blockquote> A lot of the ideas for the screen editing mode were stolen from a Bravo manual I surreptitiously looked at and copied. Dot is really the double-escape from Bravo, the redo command. Most of the stuff was stolen. There were some things stolen from [[Ed (text editor)|ed]]—we got a manual page for the Toronto version of ed, which I think [[Rob Pike]] had something to do with. We took some of the regular expression extensions out of that. </blockquote> [[File:KB Terminal ADM3A.svg|thumb|upright=2|right|[[ADM-3A]] terminal keyboard layout]] Joy used a [[Lear Siegler]] [[ADM-3A]] terminal. On this terminal, the [[Escape key]] was at the location now occupied by the [[Tab key]] on the widely used [[IBM PC keyboard]] (on the left side of the alphabetic part of the keyboard, one row above the middle row). This made it a convenient choice for switching vi modes. Also, the [[arrow keys#HJKL keys|keys ''h'',''j'',''k'',''l'']] served double duty as cursor movement keys and were inscribed with arrows, which is why vi uses them in that way. The ADM-3A had no other cursor keys. Joy explained that the terse, single character commands and the ability to type ahead of the display were a result of the slow [[baud rate|300 baud]] modem he used when developing the software and that he wanted to be productive when the screen was painting slower than he could think.<ref name=register/> ===Distribution=== Joy was responsible for creating the first [[BSD Unix]] release in March, 1978, and included ex 1.1 (dated 1 February 1978)<ref name="v1.1-version">{{cite web |title=version.c, ex 1.1 source code |work=minnie.tuhs.org |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/ex-1.1/Version.c}}</ref> in the distribution, thereby exposing his editor to an audience beyond [[University of California, Berkeley|UC Berkeley]].<ref name="1bsd-READ_ME">{{cite web |title=1BSD/READ_ME |format=roff source |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/READ_ME}} Formatted: {{cite web |title=Berkeley UNIX Software Tape |url=http://www.skytel.co.cr/bsd/research/acrobat/780201.pdf |access-date=27 December 2010 |url-status=dead |archive-url=https://web.archive.org/web/20110718162521/http://www.skytel.co.cr/bsd/research/acrobat/780201.pdf |archive-date=18 July 2011}}</ref> From that release of [[Berkeley Software Distribution|BSD Unix]] onward, the only editors that came with the Unix system were ed and ex. In a 1984 interview, Joy attributed much of the success of vi to the fact that it was bundled for free, whereas other editors, such as [[Emacs]], could cost hundreds of dollars.<ref name="interview"/> Eventually it was observed that most ex users were spending all their time in visual mode,{{Citation needed|date=November 2008}} and thus in ex 2.0 (released as part of Second Berkeley Software Distribution in May, 1979), Joy created vi as a [[hard link]] to ex,<ref name="v2-makefile">{{cite web |title=makefile, ex 2.0 source code |work=minnie.tuhs.org |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/ex/makefile}}</ref> such that when invoked as vi, ex would automatically start up in its visual mode. Thus, vi is not the evolution of ex, vi ''is'' ex. Joy described ex 2.0 (vi) as a very large program, barely able to fit in the memory of a [[PDP-11#Models|PDP-11/70]],<ref name="ex2.0-READ_ME">{{cite web |title=READ_ME |work=ex 2.0 source code |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/ex/READ_ME}}</ref> thus although vi may be regarded as a small, lightweight program today, it was not seen that way early in its history. By version 3.1, shipped with 3BSD in December 1979, the full version of vi was no longer able to fit in the memory of a PDP-11;<ref name="ex3.1-READ_ME">{{cite web |title=ex 3.1 source code |url=http://minnie.tuhs.org/cgi-bin/utree.pl?file=3bsd/usr/src/cmd/ex/READ_ME}}</ref> the editor would be also too big to run on [[PC/IX]] for the [[IBM PC]] in 1984.<ref name="iw19840402">{{cite news |title=A First Look at PC-IX |work=InfoWorld |date=1984-04-02 |author1=McMahon, Marilyn |author2=Putnam, Robert |pages=39–42 |url=https://books.google.com/books?id=kC4EAAAAMBAJ&pg=PA40 |access-date=25 February 2016}}</ref> Joy continued to be lead developer for vi until version 2.7 in June 1979,<ref name="ex-Acks-bsd4.4"/><ref name="vi-versions"/> and made occasional contributions to vi's development until at least version 3.5 in August 1980.<ref name="vi-versions">{{cite web |title=Change log for vi, versions 2.1–3.7 |work=minnie.tuhs.org |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/ucb/ex/ex.news}}</ref> In discussing the origins of vi and why he discontinued development, Joy said:<ref name="interview"/> <blockquote> I wish we hadn't used all the keys on the keyboard. I think one of the interesting things is that vi is really a [[mode (user interface)|mode]]-based editor. I think as mode-based editors go, it's pretty good. One of the good things about [[Emacs|EMACS]], though, is its programmability and the modelessness. Those are two ideas which never occurred to me. I also wasn't very good at optimizing code when I wrote vi. I think the redisplay module of the editor is almost intractable. It does a really good job for what it does, but when you're writing programs as you're learning... That's why I stopped working on it. What actually happened was that I was in the process of adding multiwindows to vi when we installed our [[VAX]], which would have been in December of '78. We didn't have any backups and the tape drive broke. I continued to work even without being able to do backups. And then the source code got scrunched and I didn't have a complete listing. I had almost rewritten all of the display code for windows, and that was when I gave up. After that, I went back to the previous version and just documented the code, finished the manual and closed it off. If that scrunch had not happened, vi would have multiple windows, and I might have put in some programmability—but I don't know. The fundamental problem with vi is that it doesn't have a mouse and therefore you've got all these commands. In some sense, it's backwards from the kind of thing you'd get from a mouse-oriented thing. I think multiple levels of undo would be wonderful, too. But fundamentally, vi is still ed inside. You can't really fool it. It's like one of those pinatas—things that have candy inside but has layer after layer of paper mache on top. It doesn't really have a unified concept. I think if I were going to go back—I wouldn't go back, but start over again. </blockquote> In 1979,<ref name="interview"/> [[Mary Ann Horton]] took on responsibility for vi. Horton added support for arrow and function keys, macros, and improved performance by replacing [[termcap]] with [[terminfo]].<ref name="ex-Acks-bsd4.4"/><ref name="vi-Acks-bsd4.4">{{cite manual |title=vi Reference Manual |series=4.4 BSD (encumbered, not Lite) |last=Joy |first=Bill |publisher=CSRG, UC Berkeley |format=roff source |url=https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/usr.bin/ex/USD.doc/vi/vi.in}} (see Acknowledgments section at end of file)</ref> ===Ports and clones=== [[File:OpenBSD vi Editor.png|thumb|The vi editor in [[OpenBSD]] (''[[nvi]]'') on startup, editing a temporary empty file]] [[File:OpenBSD vi Editor Ruby Hello World.png|thumb|The vi editor in [[OpenBSD]], editing a small [[Hello world program|"Hello, world!"]] type [[Ruby (programming language)|Ruby]] program]] Up to version 3.7 of vi, created in October 1981,<ref name="vi-versions"/> UC Berkeley was the development home for vi, but with Bill Joy's departure in early 1982 to join [[Sun Microsystems]], and AT&T's [[UNIX System V]] (January 1983) adopting vi,<ref>{{cite book |title=UNIX: the complete reference |year=2006 |publisher=McGraw-Hill Osborne Media |isbn=978-0-07-226336-7 |author=Kenneth H. Rosen |author2=Douglas A. Host |author3=Rachel Klee |page=10 |url=https://books.google.com/books?id=2Et--84HIkwC&pg=PA10}}</ref> changes to the vi codebase happened more slowly and in a more dispersed and mutually incompatible way. At UC Berkeley, changes were made but the version number was never updated beyond 3.7. Commercial Unix vendors, such as Sun, [[Hewlett-Packard|HP]], [[Digital Equipment Corporation|DEC]], and [[IBM]] each received copies of the vi source, and their operating systems, [[Solaris (operating system)|Solaris]], [[HP-UX]], [[Tru64 UNIX]], and [[AIX]], continued to maintain versions of vi directly descended from the 3.7 release, but with added features such as adjustable key mappings, encryption, and wide character support. In 1983, vi was one of several UNIX tools available for Charles River Data Systems' [[UNOS (operating system)|UNOS]] operating system under [[Bell Laboratories]] license.<ref>{{Cite book|year=1983|title=The Insider's Guide To The Universe|publisher=Charles River Data Systems, Inc.|url=https://www.1000bit.it/ad/bro/charles/CharlesRiverSystem-Universe.pdf|page=13}}</ref> While commercial vendors could work with Bill Joy's codebase, many people could not. Because Joy had begun with [[Ken Thompson]]'s [[Ed (text editor)|ed]] editor, ex and vi were derivative works and could not be distributed except to people who had an AT&T source license.{{Citation needed|date=July 2023}} Those wanting a free Unix-style editor would have to look elsewhere. By 1985, a version of [[Emacs]] ([[MicroEMACS]]) was available for a variety of platforms, but it was not until June 1987 that [[Stevie (text editor)|STEVIE]] (ST Editor for VI Enthusiasts), a limited vi clone, appeared for the [[Atari ST]].<ref name=stevie>{{cite web |last=Thompson |first=Tim |date=26 March 2000 |title=Stevie |url=https://timthompson.com/tjt/stevie/ |access-date=2010-12-29}}</ref><ref name="stevie-usenet">{{cite newsgroup |title=A mini-vi for the ST |author=Tim Thompson |date=28 June 1987 |newsgroup=comp.sys.atari.st |message-id=129@glimmer.UUCP |url=https://groups.google.com/g/comp.sys.atari.st/c/J65TpLBhfss/m/Mop3jYhvuY0J |access-date=2010-12-29}}</ref> In early January 1990, Steve Kirkendall posted a new clone of vi, ''[[Elvis (text editor)|Elvis]]'', to the [[Usenet]] newsgroup comp.os.minix, aiming for a more complete and more faithful clone of vi than STEVIE.<ref name="elvis-Kirkendall">{{cite newsgroup |title=A new clone of vi is coming soon: ELVIS |author=Steve Kirkendall |date=20 April 1990 |newsgroup=comp.editors |message-id=2719@psueea.UUCP |url=https://groups.google.com/g/comp.editors/c/rdUYDzANsMw/m/ErR-8j1VCfQJ |access-date=2010-12-29}} (discusses January comp.os.minix posting, and design goals)</ref> It quickly attracted considerable interest in a number of enthusiast communities.<ref>Usenet, various newsgroups (comp.editors, comp.sys.*, comp.os.*), 1990</ref> [[Andrew S. Tanenbaum|Andrew Tanenbaum]] quickly asked the community to decide on one of these two editors to be the vi clone in [[Minix]];<ref name="elvis-Tanenbaum">{{cite newsgroup |title=Elvis vs. stevie |author=Andrew S. Tanenbaum |date=18 January 1990 |newsgroup=comp.os.minix |message-id=5133@ast.cs.vu.nl |url=https://groups.google.com/g/comp.os.minix/c/RhqVtXMWiN8/m/6GlQiUR7aeYJ |access-date=2010-12-29}}</ref> Elvis was chosen, and remains the vi clone for Minix today. In 1989, [[Lynne Jolitz]] and [[William Jolitz]] began porting [[BSD Unix]] to run on [[Intel 80386|386]] class processors, but to create a free distribution they needed to avoid any AT&T-contaminated code, including Joy's vi. To fill the void left by removing vi, their 1992 [[386BSD]] distribution adopted Elvis. 386BSD's descendants, [[FreeBSD]] and [[NetBSD]], followed suit. But at UC Berkeley, [[Keith Bostic (software engineer)|Keith Bostic]] wanted a "bug for bug compatible" replacement for Joy's vi for 4.4BSD-Lite. Using Kirkendall's Elvis (version 1.8) as a starting point, Bostic created [[nvi]], releasing it in the northern spring of 1994.<ref name="nvi-chapter"/> When FreeBSD and NetBSD resynchronized the 4.4-Lite2 codebase, they too switched over to Bostic's nvi, which they continue to use today.<ref name="nvi-chapter"/> Despite the existence of vi clones with enhanced feature sets, sometime before June 2000,<ref>[http://ex-vi.cvs.sourceforge.net/viewvc/ex-vi/ex-vi/Changes?view=markup Changes] file, from Traditional Vi by Gunnar Ritter</ref> Gunnar Ritter ported Joy's vi codebase (taken from 2.11BSD, February 1992) to modern Unix-based operating systems, such as Linux and FreeBSD. Initially, his work was technically illegal to distribute without an AT&T source license, but, in January 2002, those licensing rules were relaxed,<ref>{{cite web |title=Caldera License for 32-bit 32V UNIX and 16 bit UNIX Versions 1, 2, 3, 4, 5, 6, 7 |work=mckusick.com |url=https://www.mckusick.com/csrg/calder-lic.pdf}}</ref> allowing legal distribution as an open-source project. Ritter continued to make small enhancements to the vi codebase similar to those done by commercial Unix vendors still using Joy's codebase, including changes required by the POSIX.2 standard for vi. His work is available as Traditional Vi.<ref>{{cite web |date=2013-03-07 |title=The traditional vi |website=SourceForge |url=https://sourceforge.net/projects/ex-vi/ |access-date=2023-07-24}}</ref> But although Joy's vi was now once again available for BSD Unix, it arrived after the various BSD flavors had committed themselves to nvi, which provided a number of enhancements over traditional vi, and dropped some of its legacy features (such as open mode for editing one line at a time). Thus BSD Unix, where Joy's vi codebase began, no longer uses it, and the [[list of Unix systems#Commercial AT&T UNIX Systems and descendants|AT&T-derived Unixes]], which in the early days lacked Joy's editor, are the ones that now use and maintain modified versions of his code. ===Impact=== Over the years since its creation, vi became the ''de facto'' standard [[Unix]] editor and a [[hacker (programmer subculture)|hacker]] favorite outside of [[Massachusetts Institute of Technology|MIT]] until the rise of [[Emacs]] after about 1984.<ref>{{cite web |last1=Smith |first1=T. J. |title=EMACS vs. vi: The endless geek 'holy war' |website=Linux.com |date=4 December 2001 |url=https://www.linux.com/news/emacs-vs-vi-endless-geek-holy-war/ |access-date=30 January 2018}}</ref> The [[Single UNIX Specification]] specifies vi, so every conforming system must have it. vi is still widely used by users of the Unix family of operating systems. About half the respondents in a 1991 [[Usenet|USENET]] poll preferred vi.<ref name="hackers">{{cite book |editor-last=Raymond |editor-first=Eric S. |editor-link=Eric S. Raymond |year=1996 |title=The New Hacker's Dictionary |publisher=MIT Press |edition=3rd |isbn=0-262-68092-0}}</ref> In 1999, [[Tim O'Reilly]], founder of the eponymous computer book publishing company, stated that his company sold more copies of its vi book than its Emacs book.<ref>{{cite web |title=Ask Tim Archive |publisher=O'Reilly |date=21 June 1999 |url=http://www.oreilly.com/pub/a/oreilly/ask_tim/1999/unix_editor.html}}</ref> ==Interface== [[File:Vi source code join line logic.png|thumb|The vi editor employed minimal logic that would aid the user. This included trivial aids such as how to join two lines together and maintain reasonable usage of whitespace.]] [[File:XPG6 vi editing its own source code on a serial terminal.png|thumb|The vi editor has a number of revisions; however, the primary purpose was to allow a user to enjoy the full "visual" screen mode of modern terminals.]] vi is a modal editor: it operates in either ''insert mode'' (where typed text becomes part of the document) or ''command mode'' (where keystrokes are interpreted as commands that control the edit session). For example, typing {{keypress|i}} while in command mode switches the editor to insert mode, but typing {{keypress|i}} again at this point places an "i" character in the document. From insert mode, pressing {{keypress|[[Escape key|ESC]]}} switches the editor back to command mode. A perceived advantage of vi's separation of text entry and command modes is that both text editing and command operations can be performed without requiring the removal of the user's hands from the [[home row]]. As non-modal editors usually have to reserve all keys with letters and symbols for the printing of characters, any special commands for actions other than adding text to the buffer must be assigned to keys that do not produce characters, such as function keys, or combinations of modifier keys such as {{keypress|Ctrl}}, and {{keypress|Alt}} with regular keys. Vi has the property that most ordinary keys are connected to some kind of command for positioning, altering text, searching and so forth, either singly or in key combinations. Many commands can be touch typed without the use of {{keypress|Ctrl}} or {{keypress|Alt}}. Other types of editors generally require the user to move their hands from the home row when [[touch typing]]: * To use a mouse to select text, commands, or menu items in a [[GUI]] editor. * To the arrow keys or editing functions (Home / End or [[Function Keys]]). * To invoke commands using [[keyboard (computing)|modifier keys]] in conjunction with the standard typewriter keys. For instance, in vi, replacing a word is {{keypress|c}}{{keypress|w}}''replacement text''{{keypress|Escape}}, which is a combination of two independent commands (change and word-motion) together with a transition into and out of insert mode. Text between the cursor position and the end of the word is overwritten by the replacement text. The operation can be repeated at some other location by typing {{keypress|.}}, the effect being that the word starting at that location will be replaced with the same replacement text. A [[human–computer interaction]] textbook notes on its first page that "One of the classic UI foibles—told and re-told by HCI educators around the world—is the vi editor's lack of feedback when switching between modes. Many a user made the mistake of providing input while in command mode or entering a command while in input mode."<ref name="MacKenzie2012">{{cite book |author=I. Scott MacKenzie |title=Human-Computer Interaction: An Empirical Research Perspective |year=2013 |publisher=Morgan Kaufmann, an imprint of Elsevier |isbn=978-0-12-405865-1 |page=1}}</ref> ==Contemporary derivatives and clones== [[File:Vim splash screen.png|thumb|The startup screen of vi clone [[vim (text editor)|vim]]]] * [[Vim (text editor)|Vim]] "Vi IMproved" has many additional features compared to vi, including (scriptable) [[syntax highlighting]], mouse support, graphical versions, visual mode, many new editing commands and a large amount of extension in the area of ex commands. Vim is included with almost every Linux distribution<ref>{{cite book |title=Beginning the Linux Command Line |last=Vugt |first=Sander van |date=2015-11-21 |publisher=Apress |isbn=9781430268291 |pages=75 |url=https://books.google.com/books?id=MbkDCwAAQBAJ}}</ref> (and is also shipped with every copy of [[macOS]]). Vim also has a vi compatibility mode, in which Vim is more compatible with vi than it would be otherwise, although some vi features, such as open mode, are missing in Vim, even in compatibility mode. This mode is controlled by the {{code|:set compatible|vim}}<ref>{{cite web |title=Vim documentation: options |publisher=vim.net/sourceforge.net |url=https://vimdoc.sourceforge.net/htmldoc/options.html#'compatible' |access-date=30 January 2009}}</ref> option. It is automatically turned on by Vim when it is started in a situation that looks as if the software might be expected to be vi compatible.<ref>{{cite web |title=Vim documentation: starting |publisher=vim.net/sourceforge.net |url=https://vimdoc.sourceforge.net/htmldoc/starting.html#compatible-default |access-date=30 January 2009}}</ref> Vim features that do not conflict with vi compatibility are always available, regardless of the setting. Vim was derived from a port of STEVIE to the [[Amiga]].<ref> {{cite interview |title=Interview: Bram Moolenaar |author=Bram Moolenaar |magazine=LinuxEXPRES |date=18 April 2005 <!-- |last=Zapletal |first=Lukáš--> |interviewer=Lukáš Zapletal |pages=21–22 |language=cs |url=https://www.linuxexpres.cz/rozhovor/rozhovor-bram-moolenaar?highlightWords=Bram+moolenaar |access-date=5 February 2015 }} <br>English translation: {{cite web |title=Interview: Bram Moolenaar |website=Moolenaar.net |url=http://www.moolenaar.net/interv_czech_en.html |url-status=dead |archive-url=https://web.archive.org/web/20120919195813/http://www.moolenaar.net/interv_czech_en.html |archive-date=2012-09-19 |quote=Is VIM derivate of other VI clone or you started from scratch? I started with Stevie. This was a Vi clone for the Atari ST computer, ported to the Amiga. It had quite a lot of problems and could not do everything that Vi could, but since the source code was available I could fix that myself.}} </ref> * [[Elvis (text editor)|Elvis]] is a free vi clone for Unix and other operating systems written by Steve Kirkendall. Elvis introduced a number of features now present in other vi clones, including allowing the cursor keys to work in input mode. It was the first to provide color syntax highlighting (and to generalize syntax highlighting to multiple filetypes). Elvis 1.x was used as the starting point for [[nvi]], but Elvis 2.0 added numerous features, including multiple buffers, windows, display modes, and file access schemes. Elvis was the standard version of vi shipped on [[Slackware Linux]] until 2020-01-13 when it was replaced with nvi due to the latter's UTF8 support, and is still the standard version on [[Kate OS]], and [[MINIX]]. The most recent version of Elvis is 2.2, released in October 2003. * [[nvi]] is an implementation of the ex/vi text editor originally distributed as part of the final official Berkeley Software Distribution (4.4 BSD-Lite).<ref name="nvi-chapter">{{cite book |last1=Robbins |first1=Arnold |last2=Hannah |first2=Elbert |last3=Lamb |first3=Linda |title=Learning the vi and vim editors |chapter-url=https://books.google.com/books?id=Eb8J3BONVxAC&pg=PA307 |edition=7th |year=2008 |publisher=O'Reilly Media, Inc. |isbn=978-0-596-52983-3 |pages=307–308 |chapter=Chapter 16: nvi: New vi |url=http://oreilly.com/catalog/9780596529833}}</ref> This is the version of vi that is shipped with all BSD-based open source distributions. It adds command history and editing, filename completions, multiple edit buffers, and multi-windowing (including multiple windows on the same edit buffer). Beyond 1.79, from October, 1996, which is the recommended stable version, there have been "development releases" of nvi, the most recent of which is 1.81.6, from November, 2007.<ref>{{cite web |title=Development versions of nvi |last=Verdoolaege |first=Sven |url=https://repo.or.cz/w/nvi.git |access-date=2011-01-01}}</ref><ref>{{cite web |title=Berkeley Vi Editor Home Page |last=Bostic |first=Keith |url=http://www.bostic.com/vi/ |access-date=2011-01-01 |url-status=dead |archive-url=https://web.archive.org/web/20061205023631/http://bostic.com/vi/ |archive-date=5 December 2006}}</ref> * [[Vile (text editor)|vile]] was initially derived from an early version of [[Microemacs]] in an attempt to bring the [[Emacs]] multi-window/multi-buffer editing paradigm to vi users, and was first published on [[Usenet]]'s alt.sources in 1991. It provides infinite undo, UTF-8 compatibility, multi-window/multi-buffer operation, a macro expansion language, syntax highlighting, file read and write hooks, and more. * [[BusyBox]], a set of standard Linux utilities in a single executable, includes a tiny vi clone. * [[Neovim]], a refactor of Vim, which it strives to supersede. ==See also== {{Portal|Free and open-source software}} * [[List of text editors]] * [[Comparison of text editors]] * [[visudo]] * [[List of Unix commands]] ==References== {{Reflist|25em}} ==Further reading== * {{cite book |last=Lamb |first=Linda |author2=Arnold Robbins |title=Learning the vi Editor |publisher=O'Reilly & Associates, Inc |year=1998 |edition=6th |url=http://www.oreilly.com/catalog/vi6/}} * {{cite book |last=Robbins |first=Arnold |author2=Linda Lamb |author3=Elbert Hannah |title=Learning the vi and Vim Editors, Seventh Edition |publisher=O'Reilly & Associates, Inc |year=2008 |url=http://oreilly.com/catalog/9780596529833/}} ==External links== {{Wikibooks}} * [https://ex-vi.sourceforge.net/ The Traditional Vi: Source Code for Modern Unix Systems] * [https://web.archive.org/web/20131111013426/http://docs.freebsd.org/44doc/usd/12.vi/paper.html An Introduction to Display Editing with Vi], by Mark Horton and Bill Joy * [https://thomer.com/vi/vi.html vi lovers home page] * [http://www.viemu.com/a-why-vi-vim.html Explanation of modal editing with vi – "Why, oh WHY, do those #?@! nutheads use vi?"] * [https://github.com/n-t-roff?tab=repositories The original source code of ex (aka vi) versions 1.1, 2.2, 3.2, 3.6, and 3.7 ported to current UNIX] {{Unix commands}} {{Authority control}} [[Category:Vi| ]] [[Category:Computer-related introductions in 1976]] [[Category:Free text editors]] [[Category:Software using the BSD license]] [[Category:Unix SUS2008 utilities]] [[Category:Unix text editors]] [[Category:Console applications]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cbignore
(
edit
)
Template:Citation
(
edit
)
Template:Citation needed
(
edit
)
Template:Cite book
(
edit
)
Template:Cite interview
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite manual
(
edit
)
Template:Cite news
(
edit
)
Template:Cite newsgroup
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Discuss
(
edit
)
Template:Emdash
(
edit
)
Template:IPAc-en
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Keypress
(
edit
)
Template:Lowercase title
(
edit
)
Template:Main other
(
edit
)
Template:Portal
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Template other
(
edit
)
Template:Unix commands
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Wikibooks
(
edit
)