All Topics  
Vi

 

   Email Print
   Bookmark   Link






 

Vi



 
 
vi is a family of screen-oriented text editors which share common characteristics, such as methods of invocation from the operating system command interpreter, and characteristic user interface features. The portable subset of the behavior of vi programs, and the ex editor language supported within these programs, is described by, and thus standardized by the Single Unix Specification
Single UNIX Specification

The Single UNIX Specification is the collective name of a family of standards for computer operating systems to qualify for the name "Unix". The SUS is developed and maintained by the Austin Group, based on earlier work by the IEEE and The Open Group....
 and POSIX
POSIX

POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho...
.

The original vi program was written by Bill Joy
Bill Joy

William Nelson Joy , commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy, Andy Bechtolsheim and Vaughan Ronald Pratt, and served as chief scientist at the company until 2003....
 in 1976 for an early BSD
Berkeley Software Distribution

Berkeley Software Distribution is the Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995....
 Unix
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 release.






Discussion
Ask a question about 'Vi'
Start a new discussion about 'Vi'
Answer questions from other users
Full Discussion Forum



Encyclopedia


vi is a family of screen-oriented text editors which share common characteristics, such as methods of invocation from the operating system command interpreter, and characteristic user interface features. The portable subset of the behavior of vi programs, and the ex editor language supported within these programs, is described by, and thus standardized by the Single Unix Specification
Single UNIX Specification

The Single UNIX Specification is the collective name of a family of standards for computer operating systems to qualify for the name "Unix". The SUS is developed and maintained by the Austin Group, based on earlier work by the IEEE and The Open Group....
 and POSIX
POSIX

POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho...
.

The original vi program was written by Bill Joy
Bill Joy

William Nelson Joy , commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy, Andy Bechtolsheim and Vaughan Ronald Pratt, and served as chief scientist at the company until 2003....
 in 1976 for an early BSD
Berkeley Software Distribution

Berkeley Software Distribution is the Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995....
 Unix
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 release. Some current implementations of vi can trace their source code ancestry to Bill Joy; others are completely new, largely compatible reimplementations.

The name vi is derived from the shortest unambiguous abbreviation for the command visual in ex
Ex (text editor)

ex, short for EXtended, is a line editor for Unix systems.The original ex was an advanced version of the standard Unix editor Ed , included in the Berkeley Software Distribution....
; the command in question switches the line editor
Line editor

A line editor is a text editor computer program that is oriented around lines.They precede screen-based text editors and originated in an era when a computer operator typically interacted with a teletype , with no video display, and no ability to navigate a cursor interactively in a document....
 ex to visual
Visual editor

Visual editors are text editor which display the text being edited on the screen as it is being edited, as opposed to line editor .The term is generally used in discussing text mode, as opposed to Graphical User Interface applications....
 mode. The name vi is , or , but never as .

Many popular implementations of vi are free and open source software
Free and open source software

Free and open source software, also F/OSS, FOSS, or FLOSS is software which is liberally software licence to grant the right of users to study, change, and improve its design through the availability of its source code....
, including some based on source code derived from Berkeley Unix. There are non-free implementations of vi, found in proprietary implementations of Unix.

Interface


vi is a modal
Mode (computer interface)

In user interface design, a mode is a distinct setting within a computer program or any physical machine interface, in which the same user input will produce perceived different results than it would in other settings....
 editor: it operates in either insert mode (where typed text becomes part of the document) or normal mode (where keystrokes are interpreted as commands that control the edit session). Typing while in normal mode switches the editor to insert mode. Typing again at this point places an "i" character in the document. How the keystroke is processed depends on the editor mode. From insert mode, pressing the escape key switches the editor back to normal 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. Non-modal editors assign most of the keys that correspond to printable characters to commands which insert those characters into the buffer. Therefore, in these editors, any special commands for actions other than adding text to the buffer must be assigned to keys which don't produce characters, such as function keys, or combinations of modifier keys such as , and with regular keys. Vi has the advantage 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 , or .

Other types of editors generally require the user to move their hands from the home row
Home row

"Home row," or "home keys" is a term that refers to certain keys of the center row of alphabet on a typewriter or computer keyboard. On the most common type of English language keyboard, the QWERTY layout, "a s d f g h j k l Semicolon" represents the contents of the home row....
 when touch typing
Touch typing

Touch typing is typing without using the sense of visual perception to find the keys. Specifically, a touch typist will know their location through muscle memory....
:

  • To use a mouse to select text, commands, or menu items in a GUI
    Gui

    Gui or guee is a generic term to refer to grillinged dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients....
     editor.
  • To the arrow keys or editing functions (Home / End or Function Keys).
  • To invoke commands using modifier keys
    Keyboard (computing)

    In computing, a keyboard is an input device, partially modeled after the Typewriter#Keyboard layout, which uses an arrangement of buttons or Push-button, which act as mechanical levers or electronic switches....
     in conjunction with the standard typewriter keys.


The design of vi is based on considering the needs of users after they have become proficient, and who then require, from the software, efficiency and convenience rather than ease of learning. Another design assumption in vi is that inserting text is not the most important operation: people who maintain text files as part of their job need to be able to quickly move around in those files, and quickly make small, precise edits in different locations. The cost of transitions to insert mode is reduced by combining the mode switch with other commands. For instance, replacing a word is replacement text 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. It's also noteworthy that an operation like this is considered one indivisible command making a single logical change. Thus both the entry of the new text and the deletion of the word can be undone by typing . Moreover, the operation can be repeated at some other location by typing , the effect being that the word starting that location will be replaced with the same replacement text.

On the other hand, designing for efficiency does not produce a command language that new users can learn very quickly, or perhaps even at all for the casual user, who might have groped his way around a completely unfamiliar non-modal program with sufficient success to produce a document.

History

Kb Terminal Adm3a
vi was derived from a sequence of UNIX command line editors, starting with ed. ed was enhanced to become em (the "editor for mortals" by George Coulouris
George Coulouris

George Coulouris was a prominent England film and stage actor....
 while a lecturer at Queen Mary College), then en. At the University of California, Berkeley
University of California, Berkeley

The University of California, Berkeley is a public university research university located in Berkeley, California, California, United States. The oldest of the ten major campuses affiliated with the University of California, Berkeley offers some 300 undergraduate and graduate degree programs in a wide range of disciplines....
, Bill Joy
Bill Joy

William Nelson Joy , commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy, Andy Bechtolsheim and Vaughan Ronald Pratt, and served as chief scientist at the company until 2003....
 enhanced em to create ex, including the addition of a visual mode. Eventually it was observed that most ex users were spending all their time in visual mode, and Joy created a direct entry command called vi
Vi

vi is a family of screen-oriented text editors which share common characteristics, such as methods of invocation from the operating system command interpreter, and characteristic user interface features....
.

Joy used a Lear-Siegler ADM3A terminal
Computer terminal

A computer terminal is an electronic or electromechanical computer hardware device that is used for entering data into, and displaying data from, a computer or a computing system....
. On this terminal, the Escape key was at the location now occupied by the Tab key on the widely-used IBM PC keyboard
IBM PC keyboard

The IBM PC keyboard and its derivative computer keyboards are standardized. However, during the 20 years of the PC architecture being constantly updated, several types of keyboards have been developed....
 (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 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 ADM3A 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 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.

In 1979, Mark Horton took on responsibility for vi. Horton added support for arrow and function keys, macros, and improved performance by replacing termcap with terminfo. In 1983, vi was added to Bell Labs System V and has not significantly changed since.

vi became the de facto
De facto

De facto is a Latin expression that means "concerning the fact" or in practice but not necessarily ordained by law. It is commonly used in contrast to de jure when referring to matters of law, governance, or technique that are found in the common experience as created or developed without or contrary to a regulation....
 standard Unix
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 editor and a nearly undisputed hacker favorite outside of MIT
Massachusetts Institute of Technology

The Massachusetts Institute of Technology is a private university research university located in Cambridge, Massachusetts, Massachusetts, United States....
 until the rise of Emacs
Emacs

Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than any other editor or word processor, numbering over 1,000....
 after about 1984. The Single UNIX Specification
Single UNIX Specification

The Single UNIX Specification is the collective name of a family of standards for computer operating systems to qualify for the name "Unix". The SUS is developed and maintained by the Austin Group, based on earlier work by the IEEE and The Open Group....
 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

Usenet, a portmanteau of "user" and "network", is a worldwide distributed Internet discussion system. It evolved from the general purpose UUCP architecture of the same name....
 poll preferred vi. In 1999, Tim O'Reilly
Tim O'Reilly

Tim O'Reilly is the founder of O'Reilly Media and a supporter of the free software and Open-source software movements. He is widely credited with coining the term Web 2.0....
, founder of the eponymous computer book publishing company, stated that his company sold more copies of its vi book than its emacs book..

Derivatives and clones

Vim Splash Screen
  • nvi
    Nvi

    nvi is a re-implementation of the classic Berkeley text editor, ex/vi, traditionally distributed with BSD, and later, Unix systems. It was originally distributed as part of the Fourth Berkeley Software Distribution ....
     is an implementation of the ex/vi text editor originally distributed as part of the final official Berkeley Software Distribution(4.4BSD). 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, multi-windowing (including multiple windows on the same edit buffer).
  • Vim
    Vim (text editor)

    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 in editing program source code....
     "Vi IMproved" has yet more features than vi, including (scriptable) syntax highlighting
    Syntax highlighting

    Syntax highlighting is a feature of some text editors that displays text—especially source code—in different colors and typefaces according to the category of terms....
    , mouse support, graphical versions, visual mode, many new editing commands and a large amount of extension in the area of ex commands. Many Linux distributions have chosen Vim as their implementation of vi. Vim also has a vi compatibility mode, controlled by the :set compatible option. This mode is automatically turned on by Vim when it is started in a situation which looks as if the software might be expected to be vi compatible.. Vim then changes some of its behaviors such that they are compatible with the vi standard. Vim features which do not conflict with vi compatibility are always available, regardless of the setting.
  • Elvis
    Elvis (text editor)

    Elvis is a powerful vi/ex clone, i.e. it resembles the Unix text editor "vi" very much but adds quite a few commands and features. Elvis is written by Steve Kirkendall and is distributed under the Artistic License which is used by Perl....
     is a free vi clone for Unix and other operating systems. This is the standard version of vi shipped on Slackware Linux, Kate OS
    Kate OS

    KateOS is a Linux distribution originally based on Slackware. It is designed for intermediate users. Its package management system uses so called TGZex packages, which unlike Slackware packages support dependency tracking , internationalized descriptions, and are much easier to update....
     and MINIX
    Minix

    MINIX is a Unix-like computer operating system based on a microkernel Software architecture. Andrew S. Tanenbaum wrote the operating system to be used for educational purposes; MINIX also inspired the creation of the Linux kernel....
    .
  • vile was initially derived from an early version of Microemacs
    MicroEMACS

    MicroEMACS is a small, porting Emacs-like text editor originally written by Dave Conroy in 1985, and further developed and maintained by Daniel Lawrence....
     in an attempt to bring the Emacs
    Emacs

    Emacs is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than any other editor or word processor, numbering over 1,000....
     multi-window/multi-buffer editing paradigm to vi users.
  • bvi
    BVI

    BVI may mean:* British Virgin Islands* bvi, a binary file editor* Buena Vista Distribution, a film distributor owned by the Walt Disney Company which distributes outside the US films produced by Disney-owned studios as well as various other films...
     "Binary VI" is an editor for binary files based on the vi text editor.
  • BusyBox
    BusyBox

    BusyBox is a software application that provides many standard Unix tools, much like the larger GNU Core Utilities. BusyBox is designed to be a small executable for use with Linux, which makes it ideal for special purpose Linux distributions and embedded devices....
    , a set of standard Linux utilities on a single executable, includes a tiny vi clone.
  • Viper, an emacs package providing Vi emulation on top of Emacs.
  • SlickEdit
    SlickEdit

    SlickEdit is a cross-platform source code editor by SlickEdit, Inc. SlickEdit provides syntax highlighting, code navigation and customizable keyboard shortcuts....
     has a vi emulation mode since version 11.


See also


  • List of text editors
    List of text editors

    The following is a list of text editors. For a list of outliners, see that article's external links....
  • Comparison of text editors
    Comparison of text editors

    This article provides a basic feature comparison for several text editors. Additional feature details are available from the :Category:Text editor features and from the individual products' articles....
  • Editor war
    Editor war

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

    This is a list of UNIX utilities as specified by IEEE Std 1003.1-2004, which is part of the Single UNIX Specification .These utilities can be found on UNIX Operating systems and most UNIX-like operating systems....
  • Vimperator
    Vimperator

    Vimperator is a Mozilla Firefox Extension designed to provide a more efficient user interface for keyboard-fluent users. The design is heavily inspired by the Vim , and the authors try to maintain consistency with it wherever possible....

Further reading


External links

  • , by Mark Horton and Bill Joy
  • from The Register
    The Register

    The Register is a United Kingdom technology news and opinion website. It was founded by John Lettice and Mike Magee in 1994 as a newsletter called "Chip Connection", initially as an email service....