[net.sources] Joining block of text in vi

stevew@tekmdp.UUCP (Stephen Wood) (08/20/83)

	I have often wanted to join blocks of text in vi as follows :

	line1
	line2			line1	linea
	line3			line2	lineb
	  :	________\	line3	linec
	  :		/	      :
	linea			      :
	lineb
	linec
	  :
	  :

	Well, here's one way to do it: 


	1) program one of your terminal keys with : ma'bddmb'ap-Jr&+

	2) goto linea and type : mb

	3) goto line1 and hit the key you programmed until all lines are
	   joined.


	This leaves your lines in the form of line1&linea. 


			Stephen Wood
			...!tekmdp!bronze!stevew

silver@csu-cs.UUCP (08/29/83)

Yes, but the more general (and easier) way to accomplish  such tricks in
vi is to use  ":map"  to define  otherwise-unused  keys  (like ^X) to do
things, like pass text through  outside  filters (in your case,  paste).
For  example,  my .exrc  defines  ":map ^X  {!}fmt  -j^M".  I can hit ^X
anywhere in a paragraph  and get it  reformatted  quickly.  Like this...
now watch closely...  wasn't that EASY?

Down with text compiling, what you see is what you deserve!

Alan Silverstein, Hewlett-Packard Fort Collins Systems Division, Colorado
ucbvax!hplabs!hpfcla!ajs, 303-226-3800 x3053, N 40 31'31" W 105 00'43"