Subject: Re: vi map question
To: None <netbsd-users@NetBSD.org>
From: Peter Bex <Peter.Bex@student.kun.nl>
List: netbsd-users
Date: 09/24/2003 22:45:50
--4ybNbZnZ8tziJ7D6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Sep 24, 2003 at 03:11:41PM -0500, Frederick Bruckman wrote:
> I don't see a trivial way to make this a macro, but if you make your
> substition in "ex" mode, like this:
>=20
>   :s/^/#/
>=20
> you can then repeat it 10 times at some other point in the file, like
> this:
>=20
>   :.,+10&
>=20
> or repeat it for a block of text (to the next non-blank line), like
> this:
>=20
>   :.,/^$/&
>=20
> The last is easy to generalize into a macro that comments out the
> entire succeeding block of text (from first non-blank line to the
> following blank line):
>=20
>   :map <key> :/./,/^$/s/^/#/^V^V^V^M
>=20
> (You have to type Ctrl-V Ctrl-V Ctrl-V Ctrl-M to get a <RETURN> into
> a macro definition.)
>=20
> Frederick

Thanks a lot, that last mapping is very useful. I applied a 0x after it to =
get
rid of the pesky extra hash on the last line.

Now kernel configging is a lot less painful ;)

Regards,
Peter
--=20
http://www.student.kun.nl/peter.bex
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
							-- Donald Knuth

--4ybNbZnZ8tziJ7D6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQE/cgJ+Lg33BXzVMqsRAoN2AJ4yI3aVgTUbm90ykhBbkN6ziHnSAACfT02S
2gkhv65QSIfkPYXINynuhRo=
=85EZ
-----END PGP SIGNATURE-----

--4ybNbZnZ8tziJ7D6--