Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2000 21:45:17 -0600 (CST)
From:      David Talkington <dtalk@prairienet.org>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: vi question
Message-ID:  <Pine.LNX.4.21.0011012139110.2831-100000@sherman.spotnet>
In-Reply-To: <Pine.BSF.4.10.10011011629320.67270-100000@andrsn.stanford.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----


[Perhaps off-topic, I'm sorry ...]

Now, that's interesting.  Forgive my ignorance, but what is that
"substitution" really doing?  It's my understanding that the
start-of-line meta represents a position (immediately left of the
first character in the line), and not an actual character ... which
suggests that it can be located as an anchor, but not removed or
altered. Obviously, the start of the line isn't "replaced" in this
case ... is this just a funky way to fool the regex (e.g. unexpected,
but useful, behavior)?

- -d

- -- 
David Talkington
Community Networking Initiative
dtalk@prairienet.org
217-244-1962

PGP key: http://www.prairienet.org/~dtalk/dt000823.asc

Annelise Anderson wrote:

>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
>

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
Comment: Made with pgp4pine 1.75-6

iQEVAwUBOgDjUr1ZYOtSwT+tAQF1TQf/Uany60BTGmAQgqhILuMHH+3WZt/JlMPi
ZzzYucDAIf0T8x3G3UljU0uQnhSJmqbVaUwHBk50HE76B7b2ieK0AC0IQ84mC4SQ
z22pR9lkQ5akjnTJ5zcvRsc39GNiI68InvcqfUAfy5cTLIJ8j8oNd5fJjH96LMML
Wg0w4LMHnMGVxMXt4o8fVqg26b6oL7zP0lvez+BfwoOp9BzLgHr2O5Wf/YViISUC
U+uo3iFuTsxO4+5qQ2BvCZ1pLQSMYy49fQ5tvhpDscg02ev+LXSdwCx6422Z3hZf
Br2xFjKbe6aGbm26wSSt8xx+zsLYqSmrWfvlE4k3cIIZ8x7C33Bvjw==
=TASF
-----END PGP SIGNATURE-----




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.LNX.4.21.0011012139110.2831-100000>