From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10872d,71c35a0e73c110d5 X-Google-Attributes: gid10872d,public X-Google-Thread: fcda7,71c35a0e73c110d5 X-Google-Attributes: gidfcda7,public X-Google-Thread: 115614,71c35a0e73c110d5 X-Google-Attributes: gid115614,public X-Google-Thread: 1164f8,71c35a0e73c110d5 X-Google-Attributes: gid1164f8,public X-Google-Thread: 11035d,71c35a0e73c110d5 X-Google-Attributes: gid11035d,public X-Google-Thread: fa528,71c35a0e73c110d5 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-08-12 10:01:49 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!news.kjsl.com!news.usenet2.org!news-proxy.abbnm.com!newsboy.eng.abbnm.com!not-for-mail From: peter@abbnm.com (Peter da Silva) Newsgroups: comp.sys.hp.hpux,comp.unix.tru64,comp.sys.dec,comp.unix.solaris,comp.sys.sgi.admin,comp.unix.aix Subject: Re: Free UNIX for non-commerical use. Date: Mon, 11 Aug 2003 15:58:05 +0000 (UTC) Organization: ABB Inc., Network Management Division Message-ID: References: <3F233C74.4F4C3BAB@ntlworld.com> <3F37B042.9060104@gwu.edu> NNTP-Posting-Host: grendel.eng.abbnm.com X-Trace: jeeves.eng.abbnm.com 1060617485 53628 198.178.0.150 (11 Aug 2003 15:58:05 GMT) X-Complaints-To: usenet@jeeves.eng.abbnm.com NNTP-Posting-Date: Mon, 11 Aug 2003 15:58:05 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: peter@abbnm.com (Peter da Silva) Xref: archiver1.google.com comp.sys.hp.hpux:30343 comp.unix.tru64:10651 comp.sys.dec:16736 comp.unix.solaris:165774 comp.sys.sgi.admin:19063 comp.unix.aix:54705 In article <3F37B042.9060104@gwu.edu>, Chris Mattern wrote: > You don't understand what he means by "insert mode". You have no idea of > what he is talking about. You have no understanding of vi whatsoever. > The opposite of "insert mode" is not "overwrite mode". The opposite > of "insert mode" is "command mode". The distinction between "insert mode" and "command mode" is an illusion. OK, OK, I'll just spill the beans. There are three modes in vi, but most people only ever see one of them. There's "vi mode", "ex mode", and "open mode". It's very rare that you'll ever leave "vi mode". In "vi mode" you are always entering a command. A command consists of an option count, a command letter, and possibly an argument. The argument is either text terminated by an escape, text terminated by a return (for convenience, when a return isn't a possible input), or another command. For example, to insert text before the current position, yuo use the insert command: "iThis is text^[" (where the ^[ is the "escape"). To search for a string, you use the search command: "/Pattern^[". Because there is only one line in a search command you can use return instead of escape. Because the insert command gives immediate feedback rather than staying in the input line at the bottom of the screen the way video teco did, it feels like a mode, and is unfortunately described as a mode in much documentation going back over 20 years... but it isn't really a mode other than (perhaps) the 'incomplete command' mode. Play with it for a while, try things like "6a123456789^[" or "I<-- ^[...", or look at what gets undone when you do an "undo" after an insert. If you think of it as "the insert command I haven't yet finished" and get used to being in a "command mode" mental mode all the time, you'll find vi a lot friendlier. "But," you say, "what about arrow keys?" :map up ^[OA k down ^[OB j left ^[OD h right ^[OC l :map! up ^[OA ^[ka down ^[OB ^[ja left ^[OD ^[ha right ^[OC ^[la That's right... they're just macros. They terminate the current command (^[), move (h, j, k, or l), and start a new insert command (a). They're a convenience feature, one I find more annoying than useful, not really part of the syntax. There's a handful of commands that were added to vi late in the design that don't follow these rules. I consider two notable: ZZ This is just a shortcut for ":x^[". ~ For some reason the switch-case command didn't take a count in the old vi. This has been fixed in most current versions. It also doesn't take an argument. It seems to have been more a convenience shortcut than a true command. -- I've seen things you people can't imagine. Chimneysweeps on fire over the roofs of London. I've watched kite-strings glitter in the sun at Hyde Park Gate. All these things will be lost in time, like chalk-paintings in the rain. `-_-' Time for your nap. | Peter da Silva | Har du kramat din varg, idag? 'U`