Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucsd!ames!elroy!orion.cf.uci.edu!uci-ics!ucla-cs!gast From: gast@lanai.cs.ucla.edu (David Gast) Newsgroups: comp.editors Subject: Re: Vi bashing Keywords: holy mackerel Message-ID: <22269@shemp.CS.UCLA.EDU> Date: 26 Mar 89 03:20:21 GMT References: <587@alice.marlow.uucp> <4048@ttidca.TTI.COM> <960@myrias.UUCP> <24@hcr.UUCP> <4129@ttidca.TTI.COM> Sender: news@CS.UCLA.EDU Reply-To: gast@cs.ucla.edu (David Gast) Organization: UCLA Computer Science Department Lines: 53 In article <4129@ttidca.TTI.COM> kevin@ttidcb.tti.com (Kevin Carothers) writes: >In article 601 <24@hcr.UUCP> >From: stacey@hcr.UUCP (Stacey Campbell) > >There are many reasons why one needs to count lines >between marks for other than deleting [ie; the ">>", "<<", "!}", etc.]. >What I presented was the *ONLY* way I know of to "C O U N T L I N E S >without having to count. How many times do I have to repeat myself! I guess you will have to repeat yourself, until you read what others write and you learn another way. Turn your flame gun off, read and learn! You have still missed the point. You do not need to count the lines in these cases. Just use the objects. Suppose you want to indent all lines up to (not including) the line beginning with /pattern. Then you type: >/^pattern. (In most cases, you probably will not need the ^, but it is there in case it is necessary). If you want to include the line with pattern, then you type: >/attern (assuming that attern is only in that one line; if you get bad results, you undo and choose a different pattern). Please note, it is not necessary to count lines. You do not have to type: 27>> You could also use the substitute command and you would not have to count lines then either, but the above way is less typing. Your other example ``!}'' makes no sense at all. This command goes from the current position to the end of paragraph. Why do you need to know the number of lines to use this command? If you want to sort all the lines until the pattern, you can type: !/patternsort. The same rule about pattern as above applies. That is, if the pattern starts a line, then that line is not included, otherwise it is. These methods are clearly faster than yours. >>>'a,'bw! wc -l 1) You do not have to mark a, then go to b and mark it. 2) You do not have to fork a shell to count lines. 3) Even after you have done the above, you still have not done the real command you want to do (delete, change, yank, indent, etc). I am not saying that there cannot be some reason why you have to count lines, but I have not seen you provide one yet. Lots of alternatives have been suggested including ``make an estimate, and undo it if it is wrong.'' Before flaming again, read the other messages and LEARN that you do NOT HAVE TO COUNT. If you want to count when that is not necessary, feel free, but do not keep telling the net that it is necessary to count. It is not. David Gast gast@cs.ucla.edu {uunet,ucbvax,rutgers}!{ucla-cs,cs.ucla.edu}!gast