Jump to content

Vi (text editor)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 81.203.105.99 (talk) at 17:00, 19 January 2004. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Vi (an initialism; pronounced letter by letter as [ vi: aI ], but generally not as a word as [ vaI ] and never like the number 6) is a screen-oriented text editor computer program written by Bill Joy in 1976 for an early BSD release. The name comes from "Visual Interface", because it was originally designed as a visual interface to the line editor ex (ex is still available by using : in command mode).

Vi can frustrate new users, because it is a modal editor. In the command mode, most of the keys are editing commands, such as moving the cursor, deleting text, and so on. In input mode, the user may type in text as expected, with the Escape key exiting this mode. Early versions of vi didn't give any indication as to which mode they were in, and it is typical of users to simply press the Escape key to ensure the editor is in command mode (it will beep if already in command mode). Current versions of vi indicate the mode on the status line or graphically. One advantage of issuing commands in a command mode is that multiple editing operations can be performed in a row with very simple keystrokes, without having to hold down the <Alt>, <Ctrl>, or other special modifier keys. For experienced users, this can lead to faster work.

Vi became the de facto standard Unix editor and a nearly undisputed hacker favorite outside of MIT until the rise of Emacs after about 1984. As of 2002 either vi or one of its clones can still be found on nearly all installations of Unix (the Single UNIX Specification specifies vi, so any system conforming to the Single UNIX Specification will have vi).

It is still widely used by users of Unix variants (about half the respondents in a 1991 Usenet poll preferred it). It starts up faster than the bulkier versions of Emacs and uses less memory, consequently even some Emacs fans often resort to it as a mail editor and for small editing jobs. When a "rescue floppy" is being built for restores following a hard drive crash, vi is often the editor chosen because it is compact enough to fit on a floppy, and because almost anyone performing rescue operations will probably be able to use it.

Vi and Emacs are classically the two sides in the editor wars.

See also: