Information about Vi

VI is the Roman numeral for the number six. VI may also refer to:

Places: Organizations: In music: Other uses:
  • vi, screen-oriented text editor software
  • Violet (name) (nickname: Vi), a feminine given name
  • Vietnamese language (ISO 639: vi), the national and official language of Vietnam
  • Intransitive verb, the abbreviation vi. is used in dictionary definitions



Enlarge picture
vi editing a temporary, empty file. Tildes signify lines not present in the file.


vi is a free software screen-oriented text editor written by Bill Joy in 1976 for an early BSD release.

About vi

The name vi is derived from the shortest unambiguous abbreviation for the command visual in ex; the command in question switches the line editor ex to visual mode. (Ex was a Unix editor that could switch between visual and command-line modes - the command line mode was to maintain some backward compatibility with an even earlier Unix editor called ed.) The name vi is pronounced in various different ways. According to Eric S. Raymond, the correct pronunciation is /viː.aɪ/,[1] but other pronunciations such as /vaɪ/ are also used.[2]

Typically, as a matter of convenience, the same program will start up in vi or ex mode, depending on the name with which it is started.

Modal Editing

vi is generally understood to be 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). Typing 'i' while in command mode switches the editor to insert mode. Typing 'i' again at this point places an 'i' character in the document. How the 'i' keystroke is processed depends on the editor mode. (From insert mode, pressing the escape key switches the editor back to command mode.)

vi can process compound commands that embed text for insertion in the document. For example, the command:

20iHello world! <enter> <escape>

would insert 20 lines in the document with the text 'Hello world!'. Rather than grapple with the notion of two mode switches while executing this command, some users view vi as a stateful filter. After processing the third character, vi changes state and begins processing input as text to be added to the file. On processing the escape, vi returns to the state in which it is ready to receive a new command.

Whether viewed as modal-ness or stateful-ness, the fact that vi processed the same keystroke in different ways depending on the history of the edit session distinguishes it from editors which are generally considered non-modal.

An advantage of a modal editor is that the use of keyboard chords (multiple keys pressed simultaneously, typically a modifier plus a letter key) is reduced or eliminated. Instead, in command mode, single keystrokes serve as commands. This results in the user's hands not having to take up awkward positions, which some find results in faster work.

Operation



Note that the intent of this section is not to provide a tutorial on how to use vi. For an example of that, see . Rather, this section describes the organization of the commands, gives a sense of the general principles of operation.

Upon start-up, vi starts in command mode (unless instructed otherwise). Typing 'i' (the letter 'i' without the quotes) enters insert mode. Any text typed thence gets added to the document, until the escape key is pressed, at which point the insert mode is exited and vi switches to command mode. (There are few more commands that switch the editor into insert mode, but they differ only in where the new text will go - before the cursor, after the cursor, above current line, below current line, etc.).

Vi Commands

There are two main classes of commands: cursor movements and text modification. Vi is the fullscreen counterpart to ex, and cursor movement is a key part of the design.

Motions
These commands move the cursor, either relative to its current position, or to an absolute position.

Relative motions can be prefixed with a count, to tell vi to repeat the motion. These are relative motion commands:
h j k lMove the cursor to the left, down, up, right, respectively. These also take a count: '8l' moves the cursor 8 letters to the right.
Return + -Move the cursor down (Return and '+') or up ('-').
w W b BMove forward ('w' and 'W') or back ('b' and 'B') by a word. 'w' and 'b' treat anything non-alphanumeric as a word delimiter; 'W' and 'B' honor only white space.
} {Move to end of current or previous paragraph, respectively.
) (Move to end of current or previous sentence, respectively.


Absolute motions do not accept a count except for special cases where it acts as a line or column number. These are absolute motion commands:
G  Go to (a specified line). E.g., "10G" moves the cursor to line 10. Without a count, vi goes to the last line of the buffer.
^Move to first nonblank character on the current line.
$Move to end of current line.
0Move to beginning of current line.


Operators
Many of the text modification commands form a special category known as operators. They can be prefixed with a count (to repeat the operator), and are suffixed with a motion command. The text between the current position and the final position (after the motion) is called a region.

These are examples of operators:
d  delete a region. "d10G" deletes lines from current line until line 10 (inclusive). Recall that "10G" moves the cursor to line 10.
cchange a region. "cwnew"<esc> - changes current word with the text 'new'. Note that "cw" essentially switches the editor to insert mode.
< >indent a region. "<)" indents left all the lines from here until end of paragraph. ">/xxx" indents right lines from here until the line containing the pattern "xxx".


In some instances, if the motion command repeats the operator character (as in 'dd'), the region is a whole line. Thus "dd" deletes the current line, and "ccnew<esc>" replaces the entire current line with the text 'new'. Prefixing it with a count repeats (or makes it apply to more than one), e.g., "10dd" deletes 10 lines.

Inline Commands
A few commands move the cursor only within the current line. Like operators, they accept a repeat count:
fletter  Move the cursor to the first occurrence of letter in the current line, starting from current position.
FletterSimilar to 'f', but in the reverse direction.
tletterMove the cursor before the first occurrence of letter in the current line, starting from current position.
TletterSimilar to 't', but in the reverse direction.
;Repeat the last forward scan.
,Repeat the last reverse scan.


Other Commands
Other commands do not fall neatly into a category:
/pattern    Search for pattern and place the cursor at the start of the matched text.
?patternSearch in the reverse direction.
%Move the cursor to the matching brace or bracket: {} [] ().
.Repeat the last command which has modified the file. This may be used in a map. For example, suppose one has substituted an underscore for a space as the last command. Then <escape>:map g j0. will set a macro-command g to perform the last . command after moving to the first column in in a line (0) and then down one line (j). From then on, one may simply press the g key to repeat the last command.
!program  Filter a region through an external program. "!Gsort" pipes all the lines from current line to the end of the document (G) to the sort program and replaces those lines in the document with the output of the sort program.

Regular Expressions

Support for regular expressions (or text patterns) is an important feature of vi. These can be used extensively in search, substitution and global search and replace commands.

Ex Commands

All of the ex commands can be used in vi by typing ":" to get a prompt, and entering the command. Exit temporarily (or permanently) from visual mode to ex by "Q", return to visual mode by ":vi".

Options
Several of vi's default behaviors can be altered using options. These take the form ":set option" or ":set nooption" and so on. Example: "set ignorecase" causes all searches to be case-insensitive.

File Commands
:w filename  Writes (saves) the current document. If the optional filename is provided, the text is saved in the specified file.
:qQuits the editor.
:e filenameLoads the specified file into the editor.
:nLoads the next file into the editor. Useful when vi was invoked from the command line with multiple file names.
:r filenameReads (inserts) the content of the specified file into the current document.


Where applicable, these commands take a line number or a range of line numbers. E.g., "10,25w newfile" will write lines 10 through 25 (inclusive) into the file newfile; "$r newfile" will read the contents of file newfile after the last line of the current document ('$' stands for the last line).

Maps and abbreviations
A frequently used command sequence can be mapped to a new command-letter. The sequence could even include any text to be inserted. E.g.,:
map * iAuthor: John Bull<esc>
causes the '*' character to be a command that inserts "Author: John Bull" at the cursor position.

An abbreviation is like a mapping, but during insert mode. Example:
abbr US United States
This will insert "United States" whenever the word "US" is typed when in insert mode.

History

Enlarge picture
ADM3A keyboard layout
Bill Joy wrote vi at the University of California, Berkeley, on a Lear-Siegler ADM3A terminal. On this machine, the Escape key was where the Tab key is nowadays, thus enabling users to very efficiently switch modes. Also, the keys h,j,k,l had arrows, explaining the usage of these keys for moving around. The ADM3A had no other keys that corresponded to arrows.

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 2007 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.

vi is still widely used by users of Unix variants. About half the respondents in a 1991 USENET poll preferred vi.<ref name="hackers" /> It starts up faster than the bulkier versions of Emacs and uses less memory. Consequently, even some Emacs fans will resort to it as a mail editor and for small editing jobs. In 1999, Tim O'Reilly, founder of the eponymous computer book publisher, stated that his company sold more copies of its vi book than its emacs book. [3]

Derivatives and clones

Enlarge picture
The startup screen of vi clone vim
  • nvi 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 "Vi IMproved" has yet more features than nvi, including (scriptable) syntax highlighting, mouse support, graphical versions, visual mode and many new editing commands. It is the standard version of vi on most Linux systems.
  • Elvis is a free vi clone for Unix and other operating systems. This is the standard version of vi shipped on Slackware Linux and Kate OS.
  • 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.
  • bvi "Binary VI" is an editor for binary files based on the vi text editor.
  • BusyBox (a set of standard Linux utilities on a single executable) includes a tiny vi clone

See also

References

1. ^ Raymond, Eric; Guy L. Steele, Eric S. Raymond (1996). in (ed.): The New Hacker's Dictionary, 3rd edition, MIT Press. ISBN 0-262-68092-0. 
2. ^ Gross, Christian (2005). Open Source for Windows Administrators. Charles River Media, p. 55. ISBN 1-584-50347-5. 
3. ^ Ask Tim Archive. O'Reilly (Jun 21 1999).

Further reading

External links

Roman numerals is a numeral system originating in ancient Rome, adapted from Etruscan numerals. The system used in classical antiquity was slightly modified in the Middle Ages to produce the system we use today. It is based on certain letters which are given values as numerals.
..... Click the link for more information.

..... Click the link for more information.
Motto
"Vigilate"   (Latin)
"Be Watchful"
Anthem
"God Save the Queen"
..... Click the link for more information.
Motto
"United in Pride and Hope"''
Anthem
"Virgin Islands March"


Capital Charlotte Amalie

..... Click the link for more information.
Victoria Island (VI) is the main business and financial centre of Lagos, Nigeria. It was originally a residential area, but businesses have been moving in steadily over the last twenty years. Today, Victoria Island is one of Nigeria's busiest centres of banking and commerce.
..... Click the link for more information.
Victoria Institution

Motto To Be a Scholar, a Sportsman and a Gentlemen

Established 14 August1893

Type Government Non-Boarding all-boys secondary School
Headmaster Pn.
..... Click the link for more information.
The Vinyl Institute (VI) is a U.S. industry trade group representing manufacturers of vinyl, vinyl chloride monomer, vinyl additives and modifiers, and vinyl packaging materials. It was established in 1982 and is headquartered in Arlington, Virginia.
..... Click the link for more information.
Volga-Dnepr Airlines is an airline based in Ulyanovsk, Russia. It operates scheduled and charter passenger and cargo services, but specialises in outsize cargo operations using the world's largest fleet of Antonov An-124 aircraft.
..... Click the link for more information.
VI Corps took part in some of the most high profile operations in World War II. Constituted in the Organized Reserves in 1921, it was allotted to the Regular Army in 1933 and activated on 1 August 1940 at Fort Sheridan, Illinois.
..... Click the link for more information.
The VI Corps (Sixth Corps) was a corps of the Union Army during the American Civil War.

The corps was organized as the Sixth Provisional Corps on May 18, 1862, by uniting Major General William B.
..... Click the link for more information.
In music, the submediant is the sixth tonal degree of the diatonic scale. It is so called because it is a third below the tonic, in contrast to the mediant being a third above the tonic. It is the mediant of the subdominant triad.
..... Click the link for more information.
Beatles VI
(1965) Help!
(1965)

Beatles VI is the The Beatles' sixth (or seventh, counting The Beatles' Story) American release on Capitol Records, although it was ninth album released into that market in less than one and a half
..... Click the link for more information.
Chicago VI
(1973) Chicago VII
(1974)

Chicago VI is the sixth album by American rock band Chicago and was released in 1973. Following the streamlined character of Chicago V
..... Click the link for more information.
VI is the fifth album by the hardcore band Circle Jerks (although a popular misconception is that this is their sixth record.) The music on the record is a sort of missing link between hardcore and grunge - on this record the band has moved further into the slower /
..... Click the link for more information.
VI Music is a Puerto Rican record label specializing in the reggaeton genre founded by the reggaeton artist Mario VI and Juan Vidal

Artists

Artists that have released records under this label include:
  • Don Omar
  • Naldo
  • Hector El Father

..... Click the link for more information.
A software synthesizer, also known as a softsynth or virtual instrument is a computer program for digital audio generation. Computer software which can create sounds or music is not new, but advances in processing speed are allowing softsynths to accomplish the same
..... Click the link for more information.
Violet is a given name for girls. The name comes from the Violet flower. As with other such names its popularity has varied dramatically over time. Flower names were very commonly used from about 1880 through about 1910 in the United States, with usage dropping throughout the next
..... Click the link for more information.
Vietnamese (tiếng Việt, or less commonly Việt ngữ[1]), formerly known under the French colonization as Annamese (see Annam), is the national and official language of Vietnam.
..... Click the link for more information.
intransitive verb is a verb that does have a subject and does not have an object. In more technical terms, an intransitive verb has only one argument (its subject), and hence has a valency of one.
..... Click the link for more information.
Free software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions only to ensure that further recipients can also do these things.
..... Click the link for more information.
text editor is a type of program used for editing plain text files.

Text editors are often provided with operating systems or software development packages, and can be used to change configuration files and programming language source code.

Plain text files vs.


..... Click the link for more information.
William Nelson Joy (born Nov 8, 1954), commonly known as Bill Joy, is an American computer scientist. Joy co-founded Sun Microsystems in 1982 along with Vinod Khosla, Scott McNealy and Andy Bechtolsheim, and served as chief scientist at the company until 2003.
..... Click the link for more information.
19th century - 20th century - 21st century
1940s  1950s  1960s  - 1970s -  1980s  1990s  2000s
1973 1974 1975 - 1976 - 1977 1978 1979

Year 1976 (MCMLXXVI
..... Click the link for more information.
Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) is the UNIX derivative distributed by the University of California, Berkeley, starting in the 1970s.
..... Click the link for more information.
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.
..... Click the link for more information.
A line editor is a text editor computer program that is oriented around lines. Now considered extremely old-fashioned, they stem from the days when a computer operator would be sitting in front of a teletype (essentially a printer with a keyboard), so there was no screen and no way
..... Click the link for more information.
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.
..... Click the link for more information.
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.
..... Click the link for more information.
ed is the standard text editor on the Unix operating system. ed was originally written by Ken Thompson and contains one of the first implementations of regular expressions.
..... Click the link for more information.
Eric Steven Raymond (born December 4, 1957), often referred to as ESR, is a computer programmer, author and open source software advocate. His reputation within the hacker culture was established when he became the maintainer of the "Jargon File".
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus


page counter