Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!ncrlnk!ncrcce!mercer From: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.misc Subject: Re: vi-like Message-ID: <1056@ncrcce.StPaul.NCR.COM> Date: 10 Mar 89 17:26:12 GMT References: <12406@dartvax.Dartmouth.EDU> <958@starfish.Convergent.COM> <2386@iscuva.ISCS.COM> <415@corpane.UUCP> <1472@umbio.MIAMI.EDU> Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Organization: NCR Comten, Inc. Lines: 95 In article <1472@umbio.MIAMI.EDU> aem@Mthvax.Miami.Edu (a.e.mossberg) writes: >In <415@corpane.UUCP>, wrote: > >>dd = delete line (why? why not dl?) >>ZZ = end edit and save file (!!!!) Why ZZ - look at your keyboard. The Z and Shift are next to each other on many (most?) keyboards. It's impossible to enter the sequence accidentally, but very convenient to enter on purpose. When I first began using vi, I was moving from IBM 3270 full screen editors, like ISPF Edit and Xedit, so I was very dependent on using PF keys. I used to use PF3 to save and exit, just like in IBM editors, but eventually found ZZ far easier to use. >>$ = end of file >>A = insert begining at end of line !?!?! > >dd-delete line The syntax for vi commands is command-character or command-character/target depending on whether the command-character takes a target. X,x and ~, for instance, do not take targets. d,y,c,! take targets. The repetition of the command character, for instance yy, dd, cc, !!, takes the current line as the target. It's completely consistent and relatively simple to remember. >dw-delete word >A-append at beginning of line >a-append after current position >I-insert at beginning of line >i-insert at current position >$-end of line >^-beginning of line > When I first got started on UNIX, my group put together a wish list for our text editor. We considered vi totally unsuitable (never having used anything more complex than Xedit). We wanted something that would allow us to insert models of text (like C skeletons) like we enjoyed with ISPF Edit and Amdahl's UTS Ned editor. We wanted to be able to reformat text, like with WordStar. We wanted to be able to edit multiple files, to move data between files, to interface actively with the shell, to have online help information, to use menus, to do block moves, a spelling checker... Finally, we found that editor - and it turned out to be !!!!! VI Yes, poor, humble, but immensely powerful vi, the Clark Kent of editors. What you need, if you are so disatisfied with vi, is a few good vi hackers to build you a toolkit to turbo charge vi and make it into whatever you want. How did we transform VI from plain Jane to Jane Fonda - simple as ! The !, w! and r! commands allow vi to read and write to the shell. For instance, the skeleton program takes the current line, writes it to a FIFO opened by a background process. That process compares the supplied line to entries in a skeleton file (a simple text file that's easy to build and maintain). If a match is found, the matching lines are written to an output FIFO that vi has opened with a :r command (all this is done by pressing a PF key with a macro defined for the needed operations). The skeleton is imported into the file at the exact indentation as the original keyword. If no match is found in the skeleton file, no problem, the lint files are searched - voila, instant lint. As for the spelling checker, that to is pf key driven, sending the current page or paragraph to the spellchecker (the UNIX spell, at least SYS5, is a horribly slow shell script. It was very easy to modify to speed up, and by sending its output to sed, the errant words can be marked so they can be easily found and corrected.) Reformatting paragraphs is also as easy as pressing one key (all you need is the correct reformatting program) as is drawing boxes (ours require special characters because they are printed on a laser printer off our MVS host). We found vi so useful, that we abandoned development of the editor portion of the user interface of our project and used vi instead. The rest of the user interface uses menus that drop down on the vi session. I was working on a split window version of vi (without touching vi object or source code) when I moved to another department). now, ZZ -- Dan Mercer Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)