Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!ccut!wnoc-tyo-news!sranha!sramha!ext46!s-fujii From: s-fujii@ext46.sra.co.jp (Seigo Fujii) Newsgroups: comp.editors Subject: Re: vi for power users Message-ID: <11853@sramha.sra.co.jp> Date: 21 Dec 90 07:30:02 GMT References: <109909@convex.convex.com> <110110@convex.convex.com> <17719@neptune.inf.ethz.ch> Sender: news@sramha.sra.co.jp Reply-To: s-fujii@ext46.sra.co.jp (Seigo Fujii) Organization: Software Research Associates, Inc., Japan Lines: 34 In article <17719@neptune.inf.ethz.ch> wyle@inf.ethz.ch (Mitchell Wyle) writes: >Good point; vi needs {!}fmt built-in. Sorry, Tom; we disagree. I don't >like waiting for the fork and exec or the popen(). I want my paragraph >formatted by my text editor. Wordstar did it for me in cp/m. vi should do >it for me also. I started writing a macro to do this, but it has bugs and I >never go it to work completely. If anyone wants to add/refine, fix, here it >is: > > >map ^XF jf k0J72^V|Er^V^M >map ;x {j^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF^XF > >It uses "f " to find a space on the current line; when it can't find a >space, it exits. Otherwise, it loops forever, joining the next line, >going to col 72, finding the end-of-current-word, adding a >carriage-return, etc. It fails if the two lines together don't make 72 >chars, and for other reasons; it is not very robust :-(. Suggestions? " " format macro " \f: Format current paragraph. " Join all line in a paragraph, then do \F macro. " \F: Repeat split line 72 cols boundary. " Stop if `l' fail. " ^[F: For recursive call \F macro. " BUGS: " Need blankline each side of paragraph. " map \f {jmm}k:'m,.j^M\F map \F 72^V|lhhhElha^M^[^[F map ^[F \F -- Seigo Fujii (Software Research Associates, Inc., Japan)