see also: Etymology of VI

See also: VI

VI is a text editor in mode text full screen written by Bill Joy in 1976 on one of the first versions of the distribution Unix BSD.

It is present of office on the majority of the systems current Unix, often in the form of a clone of the software '' VI '' original.

Origin of the name

The name VI comes from the shortest possible abbreviation (i.e. without ambiguity) of the order visual of the text editor ex . This order places ex of the mode line by line in mode Plein screen . Thus, VI was with the departure conceived like a visual interface (in English, Visual Interface ) added with the editor ex (itself based on ED). ex is always available in VI while supporting on : in mode orders. In practice, a single program is started at the time of the invocation of VI or ex , its behavior changes according to the name with which it is called.

The name vi corresponding and to the initial ones and in the name of its install, it is usually pronounced by stating the two English letters, i.e. “  vi-aille  ” , aɪ , rather than like a word with whole share . The analogy of this name with the Roman numeral VI (six) is fortuitous.

Principle of operation

VI is a modal editor, i.e. the significance of the buttons and keys change according to the mode in which it is.

In mode insertion, the typed text is inserted in the document. To press on the key Echap since the insertion mode makes it possible to place in the mode order , in which the keys correspond to displacement of the cursor or functions of edition. For example, j descends the cursor from a line, x erases the character under the cursor (the position “  under the curseur  ” can indicate the line of the cursor if this last is placed between the characters, with the top of the character of underlining or under the rectangular block, according to the way in which the terminal represents the cursor).

The keys typed in order mode are not inserted in the text, which is a frequent cause of confusion for the initial users with VI.

In mode order , many operations can be carried out in series with simple sequences of keys, without it being necessary to maintain the keys Alt or inserted Ctrl . The most elaborate operations are made up of more primary operations. For example, d3w erases three words (d for delete (to erase) and w for Word (word), c2fa changes ( changes ) the text until it finds ( find ) the second ( 2 ) has . For the experienced users, that makes it possible to work very effectively. That also makes it possible the user to permanently preserve his hands on the keyboard.

The first versions of VI did not give any indication on the mode in which they were. It was frequent that the users type automatically on the key Echap to make sure that the editor was well in the mode orders (VI emits an aural signal if it is already in this mode). The more modern versions of VI indicate the mode in a bar of state or graphically (for example the shape or the color of the cursor). Graphic implementations of VI (for example GVim) support also the use of the mouse and the menus to reach the functions of edition.

Evolution

VI De facto became the standard editor of Unix and he was the favorite editor of many Hacker S until the arrival of Emacs in 1984. To date (2005), VI or one of its clones can be found in almost all the installations of Unix. The Individual UNIX Specification (more particularly the “standard IEEE 1003.2, Share 2: Shell and utilities”) includes VI. Thus, any system conforming to this specification integrates VI.

VI is still largely used by the users of the various alternatives of Unix. It starts more quickly than the heavy versions of the Emacs editor and uses less memory. Consequently, same of the fans of Emacs use it as editor for the Email or small editions.

At the time of creation of diskette of recovery ( rescue disk , for the systems whose hard drive does not function correctly any more), VI is very often selected as editor, because of its compactness (the place is very limited on the diskettes) and owing to the fact that the majority of people carrying out of the operations of recovery are able to use it.

VI and Emacs are the eternal belligerents of the war of the editors.

Clones and derived

Many text editors based on VI exist. The clones are implementations, free or not, of VI, i.e. they theoretically respect the standard command set of the VI of POSIX. However, the majority of these clones also support additional functionalities. The derivatives are programs, text editors or not, who preserved the principle of operation of VI (partly or completely) for their own operation.
  • VI is a bearing towards the modern Unix systems of VI traditional of the BSD 3.7. This implementation, which is based on the code of ED, is free with the direction BSD since January 2002.

  • Nvi is an implementation of the text editor ex/vi distributed in Fourth Berkeley Software Distribution (4BSD). It is about the version of VI which is provided with all open distributions BSD source. It has many improvements compared to the VI traditional one, in particular the history and the edition of the orders, the Complètement of the file names, the edition of several plugs, multiwindowing (including the edition of the same plug in several windows), etc besides these improvements, its user interface is with few things close identical to that of the VI traditional one. This implementation is very compact, fast, and is melted very naturally in the Unix environment.

  • Elvis is a free clone of VI for Unix and other operating systems. He has additional functionalities, such as the syntactic Coloration, or an graphical interface for various systems.

  • Vim, for “VI IMproved”, is a clone of VI, modern and extensible, considered by much being as powerful and effective as Emacs with regard to the text-editing. It is generally provided like implementation of VI in the Linux distributions.

  • Svicc is a small clone of VI for Commodore (64)

  • Bvi “Binary VI” is an editor for the binary files, based on the text editor VI.

  • CHEAP, for “VI Coil Emacs”, is a text editor who tries to reconcile the users of VI and emacs by keeping what it estimates to be the best of the two programs.

A more complete list can be found on the suivante  page;:

To begin with VI

The users beginning with VI are often confronted with difficulties, on the one hand because of the short cuts used for each order, then because the effect of these short cuts changes according to the mode in which is VI.

Effective means of beginning with VI are to follow of an end to the other a tutoriel explaining the simplest orders. The majority of the systems providing an implementation of VI also contain a tutoriel for VI. There exist also guides of survival for the beginners.

While including/understanding her principle of operation with some explanations and the simple examples, the majority of the users can arrive to their ends with VI. However, ease (then virtuosity) with VI is generally regarded as longer to come than with the other editors with whom it is often compared. The defenders of VI affirm that this initial difficulty is largely compensated by the effectiveness of the editor once one is at ease.

Orders considered to be obscure

The beginners are often diverted by the orders of VI. These last are very often reduced to only one and single letter, and quite difficult to memorize with the first access.

The majority of the orders of VI are selected in order to:

  • to limit striking necessary. The modifiers such as Ctrl , Maj or Alt are used with greatest parsimony;
  • to limit the movements of the fingers and the hands on the keyboard. For example, in mode orders, the keys H , J , K and L makes it possible to move the cursor. As it is about one of the most important functions, the keys which are affected for him are those which the user immediately has under the fingers;
  • to facilitate average mnemotechnics to retain to them (S) effect (S). It is necessary however to keep in mind that VI was written by anglophone programmers. For example, in mode orders, d allows to erase ( D elete), i passes in mode I nsertion, w advances the cursor of a word ( W ord). By combining a format control (for example to erase: d) and an ordering of movement (for example to advance of a word: w), one obtains the sequence dw, which make it possible to erase a mot. Similairement, the order d3w erases three words.

Modal behavior

When one begins with VI, it is paramount to understand that VI has several operating processes. The two principal modes are the mode order (in which VI starts) and the mode insertion. The order i of the order mode makes it possible to place in insertion mode, while the key Echap makes it possible to pass from the insertion mode to the mode orders.

VI also has another operating process, which makes it possible to define macros-orders by integrating true a Computer programming language to automate tasks of text-editing.

It is also possible to call VI with arguments so that it automatically carries out orders at the time of the opening of a file. For example, the line of order: VI - C " 1, %s/Deux/Trois/g|: wq" FILE launch VI, which opens the file " FICHIER" , then replaces all the " Deux" by " Trois" in the file, and finally records the file and free.

Functionalities of VI

Macros and abbreviations

VI allows to define macros-orders and abbreviations.

The macros make it possible to replace a sequence of keys by others, which makes it possible to define new orders. For example, : map v 10d create the order v mode orders, which removes blocks of 10 lines.

The abbreviations make it possible to avoid typing a rather long sequence of letters. For example: : ab GNU gnu is not Unix create the abbreviation GNU , which in insertion mode is replaced by gnu is not Unix as soon as sufficient characters is typed to raise any ambiguity (the abbreviations are generally wide when a space is inserted to indicate the end of the word).

Options

The behavior of VI and its orders can be adjusted thanks to what VI calls of the “options”. The order : set makes it possible to consult them and to modify them. Certain options are Boolean, i.e. it can only take two values: true or false , or more exactly activated and decontaminated . For example: : set number that one can shorten by : naked set post the number of each line. : set nonumber : set nonu are equivalent and allow to decontaminate this option.

Among the Boolean options, one can find (nonexhaustive list): The other options take a value. For example: : set tags=. /tags indicate to VI where to seek the file of markers.

The whole of all the options available can be posted with : set all

File of configuration

The whole of the options of VI (as well as the macros and the abbreviations) can be fixed for each session of edition by adding them in the file ~/.exrc . This file is read automatically with the starting of VI, and the orders which it contains are carried out as if they were typed by the user (the : initial is useless). Example: naked set map @ dd ab sig Mr. Robert NomBienLong

Examples of orders

Simple examples of orders

The table which follows gives some basic orders of editor VI, necessary to the simplest tasks of edition.

Examples of advanced orders

The following orders show what allows VI when a user seeks of the more pointed format controls.

See too

Related articles

  • ED;
  • Nvi, free implementation (BSD) of VI;
  • Elvis, another implementation of VI, more powerful than the original one;
  • Vim, “VI IMproved” (VI improved): a clone of VI more powerful and simpler than the original;
  • War of editors.
  • Emacs - competitor traditional of VI within the framework of the War of editors.
Flaubert available on http://www.gutenberg.org/files/14156/14156-8.txt -->

Random links:Ferruccio Busoni | Hydroxylation | Hostel | Casillas de Flores | Dorothy Hamill

© 2007-2008 speedlook.com; article text available under the terms of GFDL, from fr.wikipedia.org