vi(m) tricks

I had copied a section of text from a pdf.

When I pasted it into an email I got:

insurance	against	loss	or
damage	 by	 fire,	 including	 an	 extended	 coverage	 endorsement, for	 all	 buildings	 and
personal	 property	 which	 comprise	 the	 Property.	 	 Owner	 agrees	 to	 maintain	 property
liability	 insurance	 in	 full	 force	 and	 effect	 during	 the	 term	 of	 this	 Agreement in	 an
amount	 no	 less	 than	 Two	 Million	 Dollars	 ($2,000,000.00),	 covering the	 Property,	 the
rental	 thereof, injury	 to	 persons, and damage	 of any	 property resulting	 from	 such
operation and/or use.

I started to remove spaces and reformat, and then stopped and pasted it into a vi session.

I ran “shift-J” to join all the lines into a single line, and had:

insurance       against loss    or damage        by      fire,   including       an      extended        coverage        endorsement, for        all     buildings       and    personal         property        which   comprise        the     Property.               Owner   agrees  to      maintain        property       liability        insurance       in      full    force   and     effect  during  the     term    of      this    Agreement in    an     amount   no      less    than    Two     Million         Dollars         ($2,000,000.00),        covering the    Property,       the    rental   thereof, injury         to      persons, and damage     of any  property resulting      from    such   operation and/or use.

vim

Then I used:

:g/\s\+/s// /g

and we have, ready to cut and paste into the email:

insurance against loss or damage by fire, including an extended coverage endorsement, for all buildings and personal property which comprise the Property. Owner agrees to maintain property liability insurance in full force and effect during the term of this Agreement in an amount no less than Two Million Dollars ($2,000,000.00), covering the Property, the rental thereof, injury to persons, and damage of any property resulting from such operation and/or use.

vi rules.

 

—doug