From owner-freebsd-questions Wed Nov 1 16:45: 5 2000 Delivered-To: freebsd-questions@freebsd.org Received: from andrsn.stanford.edu (andrsn.Stanford.EDU [171.66.112.163]) by hub.freebsd.org (Postfix) with ESMTP id 0532C37B479 for ; Wed, 1 Nov 2000 16:45:02 -0800 (PST) Received: from localhost (andrsn@localhost.stanford.edu [127.0.0.1]) by andrsn.stanford.edu (8.9.3/8.9.1) with ESMTP id QAA67330; Wed, 1 Nov 2000 16:40:21 -0800 (PST) Date: Wed, 1 Nov 2000 16:40:21 -0800 (PST) From: Annelise Anderson To: 8773836928@skytel.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: vi question In-Reply-To: <200011014727.589586540@skytel.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG There are two ways I know of to comment a block of lines in vi. 1) Turn on line numbering with :se nu ; the do: :7,17s/^/#/ This puts a # at the beginning of lines 7 through 17. 2) Put cursor on line where you want to start the substitution do this: :.,+10s/^/#/ That starts at the line you're on (the .) and for that line and the next 10 lines (11 total) places a # at the beginning of the line. This is especially useful in editing a kernel config file. Annelise On Wed, 1 Nov 2000 8773836928@skytel.com wrote: > Hello, > > I have been editing some > Perl scripts in vi recently, > and I find it very annoying > that Perl cannot comment > blocks of code, only lines. > > I have been reading the docs in vi, but I can't quite figure out how to do a substitute command that will, say, prepend a # to the next n lines, and later remove the # ( well, the second one I could always use :s and replace the first # with nothing for the next n lines. But the first one is still a mystery to me ). > > Any insight would be greatly appreciated. > > Thanks! > > P.S. Please cc: me, as I am not subscribed to the list with this account. Thanks again. > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message