Date: Wed, 1 Nov 2000 16:40:21 -0800 (PST) From: Annelise Anderson <andrsn@andrsn.stanford.edu> To: 8773836928@skytel.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: vi question Message-ID: <Pine.BSF.4.10.10011011629320.67270-100000@andrsn.stanford.edu> In-Reply-To: <200011014727.589586540@skytel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10011011629320.67270-100000>