🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #1276

Re: vi delete to #

#1276
From: David Lord
Date: Fri, 30 Nov 1990 22:02
24 lines
1502 bytes
>In article <1990Nov21.025246.8298@mthvax.cs.miami.edu> wb8foz@mthvax.cs.miami.edu (David Lesher) writes:
>> I'm looking for a macro that would delete to a given line
>> number. For example: You are editing a file, and are on line 5.
>> You want to delete everything up to line 17.  Now of course, you
>> can subtract in your head, and use a 12dd. But my view has always
>> computers are supposed to do those things for me! 
>> 
>> Any suggestion on a "delete to {or delete through} line #" macro?

Don't need a macro to do this, the feature is built into vi already;

d<num>G  will delete from the current line to line <num> which can be
	 before or after the line you are on.

dG       deletes from current line to end of file.
d1G      deletes from current line to line one.
d250G    deletes from current line to line 250.

Alternatively you can use:
:<num1>,<num2>d

and replace the appropriate <num> with '.'.

-- Dave Lord
Technical Details
Message-ID: <1990Nov30.220243.16988@SanDiego.NCR.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!mvb.saic.com!ncr-sd!iss-rb!booboo!davel
References: <1990Nov21.025246.8298@mthvax.cs.miami.edu> <154293@felix.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!mvb.saic.com!ncr-sd!iss-rb!booboo!davel
From: davel@booboo.SanDiego.NCR.COM (David Lord)
Newsgroups: comp.editors
Subject: Re: vi delete to #
Message-ID: <1990Nov30.220243.16988@SanDiego.NCR.COM>
Date: 30 Nov 90 22:02:43 GMT
References: <1990Nov21.025246.8298@mthvax.cs.miami.edu> <154293@felix.UUCP>
Sender: hdf1@SanDiego.NCR.COM (Harold Ferrari)
Reply-To: davel@booboo.SanDiego.NCR.COM (David Lord)
Distribution: na
Organization: NCR Corporation, Rancho Bernardo
Lines: 24