🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3441

Deleting blocks in vi (was Re: Vi bashing)

#3441
From: Robert J. Drabek
Date: Wed, 15 Mar 1989 23:37
61 lines
2621 bytes
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.
> 
> 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".

Most people use   dd   to delete a line.

But there IS a way to "Just Say Delete": it is   d   (lower-
case letter d) followed by a move command.

Note:

dfx	Delete from the cursor to where the letter x is found on the
	current line.  Of course, x can be any character.

dG	Delete everything to the end of the file

d100G	Delete everything to line 100.

d/pat	Delete to where the pattern   pat   is found.

dh	Delete the previous character.

d0      Delete everything on the line up to the cursor.

d4w	Delete four words.

d}      Delete to the end of the paragraph.

I guess you've gotten the idea from these examples.

To delete a marked block as in Kevin's example is much, much easier
than as given.  Mark the last part of the block to be deleted by going
there and typing   ma   (this marks the spot with a label a).  Move
to the beginning of the block and type

d'a


> When vi also becomes user-friendly, 
> clearly documented, and easy to use, please post.

Agreed, vi is not clearly documented.  Few things are, but I have
noticed an improvement in documentation of some new software over the
years.  Or maybe I am just getting better at reading it.
-- 
Robert J. Drabek
Department of Computer Science
The University of Arizona
Tucson, AZ  85721
Technical Details
Message-ID: <9728@megaron.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ig!arizona!robert
References: <587@alice.marlow.uucp> <4048@ttidca.TTI.COM> <960@myrias.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ig!arizona!robert
From: robert@arizona.edu (Robert J. Drabek)
Newsgroups: comp.editors
Subject: Deleting blocks in vi (was Re: Vi bashing)
Summary: solution
Keywords: user-friendly, clear documentation, ease of use
Message-ID: <9728@megaron.arizona.edu>
Date: 15 Mar 89 23:37:39 GMT
References: <587@alice.marlow.uucp> <4048@ttidca.TTI.COM> <960@myrias.UUCP>
Organization: U of Arizona CS Dept, Tucson
Lines: 61