Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!vsi!friedl From: friedl@vsi.COM (Stephen J. Friedl) Newsgroups: comp.unix.questions Subject: Re: Vi Summary: How to do it with nroff... Message-ID: <1128@vsi.COM> Date: 7 Jun 89 06:59:55 GMT References: <19890@adm.BRL.MIL> <13816@dartvax.Dartmouth.EDU> Organization: V-Systems, Inc. -- Santa Ana, CA Lines: 36 In article <19890@adm.BRL.MIL> thoyt@ddn-wms.arpa (Thomas Hoyt) writes: > Can Vi reformat a paragraph, justifying it properly.... In article <13816@dartvax.Dartmouth.EDU>, andyb@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 " " 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@vsi.com / {attmail, uunet, etc}!vsi!friedl "Friends don't let friends run Xenix" - me