Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!ncrlnk!ncrcce!mercer From: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.editors Subject: Re: Vi bashing Keywords: user-friendly, clear documentation, ease of use Message-ID: <1173@ncrcce.StPaul.NCR.COM> Date: 16 Mar 89 20:17:06 GMT References: <587@alice.marlow.uucp> <4048@ttidca.TTI.COM> <960@myrias.UUCP> Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer) Organization: NCR Comten, Inc. Lines: 100 In article <960@myrias.UUCP> dbf@myrias.UUCP (David Ferrier) writes: :In article <4048@ttidca.TTI.COM> kevin@ttidcb.tti.com (Kevin Carothers) writes: :>I am continuously amazed at the lack of knowledge about Vi some of the :>people who post to this newsgroup display! :>NO, you DO NOT have to count lines! [to delete a block of text] :>1. Mark the beginning and end of your block of text :> Lets say the beginning is register "a", and the end is "b". :>2. Enter the following command: :> :'a,'bw !wc -l :> +---- This space is very important. :>If you don't like Vi, fine. Just don't post untrue junk about it. : :Thanks for posting an ingenious and elegant solution. :With my amazing lack of knowledge of vi, it would have taken me :hours of pulling together information scattered among many :pages of UNIX documentation on vi, ex, and wc to come up with :this nifty get-around. : :It also highlights the problem that in vi there is no EASY, OBVIOUS way :to delete a large block of text. For dozens of other editors, :the procedure is "Just Say Delete". When vi also becomes user-friendly, :clearly documented, and easy to use, please post. :-- :David Ferrier | computer: :Edmonton, Alberta | a million morons :UUCC:alberta!myrias!dbf | working at the speed of light Well, I let this go as long as I could, but mo one else has spoken up to correct this entry, so I guess I have to. Far from being ingenious and elegant, the solution offered goes the long way around. Want to delete text? Fine, there's any number of solutions. Counting lines and saying, for instance, 8dd is one, but very inelegant. Want to delete the next paragraph: d} previous paragraph: d{ In vi, the syntax is command-target for d(elete) y(ank) c(hange) and !(shell) Targets include: (command-letter) - same line (dd yy cc !!) l char to the right j current line k current an previous line h previous char H current line to top of screen 5H current line through 5th line from top L current line through last line on screen 5L current line through 5th line from bottom G current line to end of file 1G current line through 1st line of file 20G current line through 20th line of file (use :set nu to set line numbering on, or control G to determine line number. :se nonu turns off line numbering) ) current character to end of sentence ( current character to end of previous sentence } current line through next paragraph { current line through previous paragraph ]] current line through next section [[ current line through previous section 'a current line through line marked by a `a current character through character marked by a (marking previously explained) /pattern current line through line containing pattern ?pattern same, only reverse search n through next occurrance of pattern N through previous occurrance of pattern ' current line to previous mark ` current character to previous mark same line f - char current character to found char commands F - char current character to previous found char ; current char to next found char , current char to previous found char w current word (and trailing space) e end of current word (preserve space) b to beginning of current word There are probably some other targets I've forgotten, or some other block moves that are possible. I know of no word processing or text editor program with so many easy ways to move and copy data. As for the documentation, you need to get a UNIX editor manual (how else can you use sed?) and play with the editor. Man files just won't tell you what you want to know. -- Dan Mercer Reply-To: mercer@ncrcce.StPaul.NCR.COM (Dan Mercer)