Vi

Stephen J. Friedl friedl at vsi.COM
Wed Jun 7 16:59:55 AEST 1989


In article <19890 at adm.BRL.MIL> thoyt at ddn-wms.arpa (Thomas Hoyt) writes:
>   Can Vi reformat a paragraph, justifying it properly....

In article <13816 at dartvax.Dartmouth.EDU>, andyb at coat.com (Andy Behrens) writes:
> If you put the following line in your .exrc file, you can type "V" when
> the cursor is anywhere in a paragraph, and the entire paragraph will be
> rejustified by being piped through "fmt".
> 
> 	map V   0}!{fmt^M}
> 
> Note: the ^M above represents an actual carriage return.  You will need
> to type "<ctrl-V> <return>" when editing the .exrc file.

Most Sys V machines don't have fmt, so you can do the same thing
with a shell script in front of nroff:

	# fmt.sh
	{
		cat <<-!
			.hy 0	\' hyphenation off
			.pl 1	\' no pagefill lines
			.na	\' don't adjust right margin (leave ragged)
		!
		exec cat $@
	} | nroff

If you don't have nroff then I'm sure somebody will come up with a
sed script for it :-).

     Steve

-- 
Stephen J. Friedl / V-Systems, Inc. / Santa Ana, CA / +1 714 545 6442 
3B2-kind-of-guy   / friedl at vsi.com  / {attmail, uunet, etc}!vsi!friedl

"Friends don't let friends run Xenix" - me



More information about the Comp.unix.questions mailing list