vi is a screen-oriented text editorcomputer program written by Bill Joy in 1976 for an early Berkeley Software Distribution release. The name comes from the shortest unambiguous abbreviation for the command visual in ex (editor). The command in question switches the line editorex (editor) to visual mode.
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. "vi" is an initialism; pronounced letter by letter as (in International Phonetic Alphabet for English), but generally not as a word, as , and never like the Roman numeralVI (i.e., "six").
vi can frustrate new users, because it is a modal editor. A modal editor (or any modal program) assigns different meanings to buttons or keystrokes depending on which editing mode is active. The two major modes of editing in vi are "insert" and "command" mode. In insert mode, text typed is inserted into the document normally. Pressing the escape key while in insert mode will switch the editor to command mode. When in command mode, each letter corresponds to a cursor movement or editing function (for example, "j" to move down a line, "k" to move up a line, "x" to delete a character, and "i" to return to insert mode). Keys pressed while in command mode are not inserted into the text, which is probably the most common cause for confusion among new users.
An advantage of having a separate command mode is that multiple editing operations can be performed in a row with very simple keystrokes, without having to hold down the , , or other special modifier keys. The more complicated editing operations are strung together from simple primitives (for example, "dw" to delete a word, or "c2fa" to change text from the cursor until finding the second "a"). For experienced users, this can lead to faster work. It also means that the user's hands never need to leave the keyboard.
Early versions of vi did not give any indication as to which mode they were in, and it is typical of users to simply press the Escape key to ensure that 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. Graphical implementations of vi (for example, gvim) also fully support the use of a mouse and menus to access editing commands.
vi became the de facto standard Unix editor and a nearly undisputed hacker favorite outside of Massachusetts Institute of Technology 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 1991Usenet poll preferred it). 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. 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 be able to use it.
vi and Emacs are classically the two sides in the editor wars.
== vi trivia ==
vi was written in [http://csua.berkeley.edu/~tobin/wiki/moin.cgi/Evans_20Hall Evans Hall] at the University of California, Berkeley.
==vi derivatives and clones==
vim\">vim_(text_editor)">Image:vi-splash.png|thumb|254px|The startup screen of vi clone vim\">vim (text editor)
*vi is a port of the classic BSD vi 3.7 to modern Unix systems. It uses ed as a codebase, which is Berkeley Software Distribution-style free since January 2002. [http://ex-vi.sourceforge.net/]
*nvi is an implementation of the ex/vi text editor originally distributed as part of the Fourth Berkeley Software Distribution.(4BSD)
*elvis (text editor) is a free vi clone for Unix and other operating systems.
*Vigor the popular Unix editor vi with the addition of the Vigor Assistant, a deliberately irritating animated character modelled on Microsoft Office's Clippy.[http://vigor.sourceforge.net/]
*VILE
*vim (text editor) "Vi IMproved" is an updated and extended clone, considered by many to be ''roughly'' equivalent in power to Emacs
*bvi "Binary VI" is an editor for binary files based on the vi text editor.[http://bvi.sourceforge.net/]
*svicc is a small VI Clone for the Commodore (64) [http://www.floodgap.com/retrotech/cbm/svicc/]
==See also==
*List of text editors
*Comparison of text editors
==Further reading==
Oualline, Steve (2001) ''Vi IMproved - Vim'', New Riders Publishers, 572 pp.
==External links==
*[http://www.thomer.com/vi/vi.html vi lovers home page]
*[http://www.saki.com.au/mirror/vi/ The vi Editor and its clones and programs with a vi like interface]
*[http://www.webmaster.crevier.org/vi/ vi Editor Resources]
*[http://vilearn.org/ The interactive vi tutorial]
*[http://www.hut.fi/~thyle/vi_opas.html Quick vi tutorial]
*[http://www.sharpened.net/resources/vi_reference.php Vi Reference - List of Vi Commands]
Free softwareLinux text editorsMac OS text editorsUnix programsvi:Vi
Vi
Moved from main page:
''But it fairly frequently is pronounced /vi/. Shouldn't Wikipedia be descriptive rather than prescriptive?''
:It's like the argument about what a particular city should be called; as the people who founded it / live there, or as outsiders might call it. In this case, the originators of the program always said /V-I/, so that's the official pronounciation in my book. As an aside, if you say /vi/ or /siks/, then you'll sound like a doofus to more experience Unix users, and you wouldn't want that, now would you? -- user:ansible
I take it it's meant to be pronounced "V. I", like the two letters. We need to fix this:
: we-aye" = /vi aI/
as the two things don't agree. See SAMPA. "V.I." is [vi: aI]. The often-used but incorrect pronunciation is (I'm guessing) like the word "vye" as in "vye for his affections": [vaI]. COuls someone with knowledge of phonetics AND this program check? -- User:Tarquin
----
I'm generally in favor of descriptive-rather-than-prescriptive, but as a 20-year Unix veteran, I will verify that indeed, anyone who says "vye" or "six" will be instantly tagged as a clueless newbie. It's "vee eye". In fact, it's "vee eye" even when it's "vim" :-) I'm not that familiar with SAMPA, but I'll look it up and try to fix that. --User:Lee Daniel Crocker
If it's "V. I" like the two letters it's [vi: aI]. I'll fix that on the subject page. -- User:Tarquin
----
I'm going to try to put a date on vi's creation. The commonly-quoted date is 1976.
In [http://www.cs.pdx.edu/~kirkenda/joy84.html this interview], Bill Joy says "it was probably '76". He apparently started it in 1975, but lost the ex source code in 1976. He started the screen editor late in '76, while listening to election results on the radio.
[http://www.oreillynet.com/pub/a/network/2000/03/17/bsd.html O'Reilly] contradicts slightly, saying the ex Pascal source code was published with BSD early in 1977. That is consistent with ex/vi being written in late 1976. But I have not found any information about when the name vi came into use. --User:Nate Silva 01:01, 9 Jan 2004 (UTC)
----
The "vai" pronunciation appears to be standard usage at Sun Education in Melbourne, Australia. So I changed the entry to say 'generally' not pronounced that way. In any case, it's evident there's enough controversy around it to mention it - User:David Gerard 16:06, Jan 9, 2004 (UTC)
----
Am I the only one who feels uncomfortable with capitalizing it as "Vi" at the beginning of a sentence? Or is there a Wikipedia policy about mangling case-sensitive stuff? -- User:Kimiko 13:12, 3 Mar 2004 (UTC)
:vi is one of those odd things caused by Unix: a proper name that must start with a lower-case letter. A good typographical way to get around it would be to consistently render it as <tt>vi</tt> (rendered as vi) throughout the article. - User:David Gerard 13:29, Mar 3, 2004 (UTC)
:The classic thing to do here is to re-write the sentence so that it doesn't begin with 'vi' or whatever lowercase doo-dad (program, function call, etc.) you're talking about. --User:Ansible 00:36, 2004 May 26 (UTC)
vi looks weird when the monospace font doesn't look at all like the variable width font used for the rest of the text (most mono fonts don't look so good in between varwidth text). Leaving it as vi everywhere looks best imho. -- User:Kimiko 13:44, 3 Mar 2004 (UTC)
----
Is the screenshot in this article "vi" or "nvi"? I don't think the original "vi" shows the status line at the bottom of the screen (Solaris (:version = Version SVR4.0, Solaris 2.5.0) and HP-UX (:version = HP Version $ B.11.23 Jul 15 2003 02:09:47 $) do not), whereas "nvi" (:version = Version 1.79 (10/23/96) The CSRG, University of California, Berkeley.) does. User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 09:01, 2004 Jun 20 (UTC)
:I'll check at work tomorrow (on Solaris 8) and get a new shot if needed - User:David Gerard 19:45, 20 Jun 2004 (UTC)
----
Except, vi is not actually modal, or at least, that's how it was explained to me. "Don't think of vi as being modal!". It's actually a stateful filter :-). It's a very very fine distinction, but vi is based on ex, and you can actually still use it as a Filter_program! User:Kim Bruning 09:35, 21 Jun 2004 (UTC)
:What, exactly, is a "modal editor", then? User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 09:36, 2004 Jun 21 (UTC)
:: What most people actually use vi as. vi is actually more capable than merely a modal editor would be, but most people don't see the distinction, and consequently don't make optimal use of vi. (Not that I'm so great at it :-P ) User:Kim Bruning 10:04, 21 Jun 2004 (UTC)
:::Are you referring to ex mode? Or ex commands in vi mode? User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 10:06, 2004 Jun 21 (UTC)
:::: It's kind of funny to be asking me that , right at the moment where I was just claiming vi isn't modal. Having noted this, the following are all valid answers:
::::* yes.
::::* it doesn't matter.
::::* mu.
Ah well, you left your funny-bone at home today you say?
Very well, heres a slightly more serious answer.
In vi, you can do things like:
20iI am not naughty^M^[
(where ^M is return, and ^[ is escape)
I think my school teachers knew about this before I did, because for some reason they always insisted that I use handwriting for this kind of thing.
The above works because it is interpreted as a single command by vi, and not as a sequence of mode switches like some folks might expect.
I hope that gives you a bit of an idea at least, I'm a bit too sleepy to go figuring out something more decent. I hope this gives you a first inkling. If it doesn't, please forgive me, and maybe I'll type something more enlightening tomorrow. :)
Have a nice evening! User:Kim Bruning 20:33, 21 Jun 2004 (UTC)
:Well, actually the above would work anyway, because of the way Unix's keyboard/terminal buffering works: extraneous input is held in the buffer, and vi reads it as needed. So if you type "ifoobar^[", vi reads "i", enters insert mode, then reads "foobar" from the terminal buffer, then reads "^[". All this is handled outside of vi—it doesn't require any special code for this to work. Even if this wasn't the case (which I'd find unlikely, but who knows) the effect as observed by the user would be identical. So I don't believe there is any functional difference between a "modal editor" and what you're saying vi is, and non-functional differences are details of implementation. User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 14:41, 2004 Jun 22 (UTC)
There's 2 answers to this. I'll just do one for now:
what does :
20ifoobar^[
do?
Try it. There's something a bit wrong there wrt assuming vi is a modal editor :-) I'm terribly sorry about not giving this my all, but for some reason I keep being either tired or have a headache when logging on to wikipedia recently. User:Kim Bruning 17:44, 22 Jun 2004 (UTC)
:User-visible effect: vi types "foobar" 20 times.
:What vi sees: User types "20i". Vi enters insert mode with an argument of 20. User types "foobar" then ^[. Vi types "foobar" 20 types, then leaves insert mode and enters command mode. What is not modal about this? User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 17:53, 2004 Jun 22 (UTC)
:: So which mode does vi enter when you typed 20? User:Kim Bruning 18:13, 22 Jun 2004 (UTC)
:::Why would it change mode for that? "i" is a command, "20" is the argument; it's "i" that changes the mode, although the full "command" can be considered "20i", as it's one unit. User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 18:16, 2004 Jun 22 (UTC)
::::Okay, well vi has a repeat last command. It's '.' (a period). So does vi now repeat 20i (and leave you in 'insert mode' like you claim) , or does vi actually repeat 20ifoobar^[ . Try it and see which? User:Kim Bruning 18:21, 22 Jun 2004 (UTC)
:::::I'd like to ask you something. If vi isn't a modal editor, what ''is'' a modal editor? - User:David Gerard 18:23, 22 Jun 2004 (UTC)
:::::Please be more careful when attributing words to other. I never "claimed" that the "." command does anything, since it wasn't discussed. Now, as to what "." actually does; according to my vi manual (vi(1)), the "." command is used to "repeat [the] last change" [http://docs.sun.com/db/doc/817-0707/6mgg5uncf?a=view#COMMAND%20SUMMARY]. It doesn't mention last command, although I would think describing it as "repeating the last command" is a reasonable way to describe it without leading to claims that vi "is not a modal editor". Now, rather than continuing to provide vague examples, would you like to actually describe why, in your opinion, vi is not a modal editor? User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 18:29, 2004 Jun 22 (UTC)
:::::: It's a test to show what vi actually sees as a command. We're arguing about split hairs anyway, but well, this is an encyclopedia, so I guess that's ok just this once. You postulated that 20i is a full command. The idea was to show that in fact vi sees 20ifoobar^[ as the full command.
:::::: That's interesting, because it means that vi might actually see it as a single unit. If so, we can skip asking about mode changes, since they never actually come into the picture.
:::::: Summing up, vi is an ed descendant through ex. I don't think many folks seriously see ed (or ex) as being a true modal editor at all. Then people look at visual mode and just assume I guess.
:::::: User:Kim Bruning 19:14, 22 Jun 2004 (UTC)
:::::::So what you're saying is that you do understand that everyone else considers it a modal editor, you just have a private definition of "modal" that says it isn't. Settled then - User:David Gerard 19:28, 22 Jun 2004 (UTC)
:::::::: Actually I hadn't addressed your question yet. :-) See the current article. Also see: mode under computer software. A modal editor is an editor in which the keys change their meanings depending on what mode the editor is in. Sounds a lot like vi, right? Well, not quite. Apparently vi isn't really a great example of a modal editor, based on that definition. I've heard people quite seriously explain why vi is not really modal. Somehow I've managed to maneuver myself into a position where I'm defending that side of the argument for once. :-P User:Kim Bruning 20:08, 22 Jun 2004 (UTC)
:::::::Is your entire platform for calling it not modal based upon the existence of the "." command? And if so, how does that make it not modal? You can't "skip around" the mode changes in the "." command because there aren't any. "." repeats the last change—that is, the ''result'' of the last command(s). There is, obviously, no mode change involved in that, even though "20ifoo^[" involves two mode changes. User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 19:37, 2004 Jun 22 (UTC)
:::::::: Hmmm, I didn't directly mention '.' again in my last argument at all. But aren't you reaching a bit? What's easier to implement, just execute a single parsed command again, or try to figure out exactly what changes happened last (when is last?) combined whith which spaghetti tangle of mode changes?
:::::::: I'm not really happy with me being the one to bring forward this dissent, it's just that I have known folks who did put it forward like this. (Specifically, the fellow who taught me vi :-) ). If I can just convince you it's not quite as cut and dried as you think, and that some people have a different opinion, well, that's all I'm asking for. User:Kim Bruning 20:08, 22 Jun 2004 (UTC)
:::::::::Some people are also of the opinion that the earth is flat. I have yet to see any actual suggestion of why "modal" does not apply to vi, please provide one (not more "examples", please, an actual reason).
:::::::::''Apparently vi isn't really a great example of a modal editor, based on that definition'' -> why not? In what way do keys not change meaning based on the mode? (FWIW, mode doesn't say that 'keys change meaning', only that vi has 2 (3) modes.) User:Lady Lysine Ikinsile — User:Lady Lysine Ikinsile 20:34, 2004 Jun 22 (UTC)
:::::::::: It is argued by some that vi doesn't really have modes. For some reason I'm defending that argument ;-) To try and do that, I've shown that vi has some behaviours that are not easily explained by modes. You tried to explain the example I gave, and got a bit of a spaghetti explanation, I tried it and explained in one sentance. I've also told you that vim is derived from ex, which is not a modal editor at all.
:::::::::: The current vi article is the article that talks about 'keys change meaning'. Also, the article points out that vim is the only vi which actually 'displays your editing mode', while all the others apparently don't. I've been told that vims' behaviour is actually considered incorrect in this respect.
:::::::::: Once again, I'm not the best person to defend this argument, but I'll try to do my best until/unless a better expert on this pov comes along. User:Kim Bruning 20:59, 22 Jun 2004 (UTC)
Okay, well I'm really spending way too much time on this, but here goes.
Consider these 3 lines:
#1
echo -e '$_="just another crazy hacker\\n";\ns/crazy/perl/;\nprint;\n '| perl
#2
echo -e 'a\njust another perl hacker\n.\ns/perl/ex/\nw! testme'| ex && cat testme
#3
echo -e 'ajust another perl hacker\E:s/perl/vi\n:w! testme\n:q!'| vi && cat testme
They all have similar input, and equivalent output. The thing is, there's probably not many folks who would say the top 2 lines are some form of modal input.
Based on what I think is being said here, you might claim that line 3 *is* modal in some way.
Okay, that's interesting.
So did I predict right, and will you be calling the 3rd line modal? If so, why?
I'm interested in hearing your arguments. :-)
Quickly answering your question "why does modal not apply to vi", well, the answer to that was right at the start of this debate: ''vi is actually a stateful filter''.
See if you can look at it this way: vi is a special mode of ex, which takes input in a specific way, and parses it as a special case of ex commands.
User:Kim Bruning 08:49, 23 Jun 2004 (UTC)
====Feature article?====
Although I'm not a vi user (I'm a BBEdit guy), I'm wondering if there are plans to promote this article as a feature article, considering that Emacs recently got its 5 minutes of fame. Surely we can tap into the rivalry in a good way, as opposed to the typical flame war. :-)
:The vi article is nowhere near ready for being a feature article. So anyone supporting such an idea had better a cunning plan for improving the article first. Nothing to stop you from putting ''that'' plan into practice. User:Rl 07:54, 6 Oct 2004 (UTC)
==Pronunciation==
I've converted the SAMPA to IPA (without prejudice to the debate as to hte question how it should be pronounced - by the way from my UNIX days I always remember it being called "vye" as a single word - and removed the convertIPA template. User:Ross Burgess 14:22, 24 Feb 2005 (UTC)
:''I always remember it being called "vye" as a single word''
:I think that must be a regional dialect. :-) In the shops I've worked in, it's always been "vee-eye". But there is some support for your position to be found in the editors "vile" and "vim", which are definitely pronounced as words.
:User:Atlant 17:06, 24 Feb 2005 (UTC)
==Inciting the editor wars==
A recent editor added (regarding vim) ''equivalent in power to Emacs''.
Now you've done it!
To Emacs partisans, nothing is as powerful as Emacs. The Nuclear fusion power of a galaxy of star powering Sagans worth of IBM Z/OSmainframe computers couldn't rival the power of Emacs. Surely, someone will be along to blast this statement soon.
User:Atlant 14:50, 23 Mar 2005 (UTC)
: I'll quickly change it to ''roughly'' equivalent in power to Emacs, in that way, the statement becomes ''mostly'' harmless. ;-) User:Kim Bruning 17:16, 23 Mar 2005 (UTC)
::Well done -- thanks!
::User:Atlant 17:27, 23 Mar 2005 (UTC)
== Does this article contradict itself? ==
Did Bill Joy or Evans Hall write it?
:Bill Joy wrote it while sitting in Evans Hall, a building at the University of California at Berkeley.
:User:Atlant 13:04, 27 Apr 2005 (UTC)
== Picture on main page? ==
Why is there a picture of the Vim startup screen on the vi article? The two really are different, and the picture that used to be up, which showed simply a blank screen with tildes, did a better job of portraying the minimalist nature of the editor. In fact, I do not believe that plain vi even has a startup screen.--User:Shutranm 18:50, 29 May 2005 (UTC)
:I looked through the page history (not very thoroughly) and couldn't find a page version showing regular vi, so I made my own. And you're right that there's no startup screen; I'd better go amend the caption. - User:Mako098765''User_talk:Mako098765'' 19:56, 29 May 2005 (UTC)