🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3089

Re: formatting in vi

#3089
From: Hans Mulder
Date: Mon, 08 Feb 1988 17:26
54 lines
2157 bytes
In article <215@cb.ecn.purdue.edu> patkar@cb.ecn.purdue.edu (The Silent Killer) writes:
>In article <???> Robert J. Drabek writes:
>
>>There has been a problem I have had with formatting paragraphs in
>>vi: the definition using "}" seems to be "up to the next empty line",
>>but when editing *roff files I only want to format up to the next
>>line containing a dot command.

Actually, "}" stops at the end of the paragraph, which can be an empty line
or an .IP, .LP, .PP, .QP, .P, .LI or .bp request (when using *roff)
(This is the default.  Put a `set paragraphs=whatever' line in your .exrc
 file if you don't like it.)

>>
>>So, how do I easily tell vi to stop where desired?
>
>
>    You can put the following line in your .exrc.
>
>map  /^\.

This line was either scrambled by some mailer, or it contains
non-printing characters.  I suppose it should have read

map g /^\.^Mma''!'afmt^M

Here ^M stands for a ctrl-M character which you enter into your file by
typing <ctrl-V><ctrl-M>.
This defines the `g' command as `run the buffer between the current line
and the next line beginning with a dot (inclusive) through the `fmt'
command'.

>
>>Robert J. Drabek
>
>Anant patkar

Actually, you don't need to mark anyhting.  Simply define:

map g !/^\.^Mfmt^M

This does the same without the marking business.  The point is that the `!'
command (and others, like c, d, s, <, > ) takes as its first argument a
move-type command, and / is a move command.  So you can do things like
`d/foo' or `>/end'.

P.S. I believe the manual forgets to mention that your .exrc file is not
read if you have defined an EXINIT evironment variable.  So, if you already
have an EXINIT variable, add your `map' commands to it, rather than
producing an .exrc file.

Hope this helps,

Hans Mulder
Technical Details
Message-ID: <192@piring.cwi.nl>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!hansm
References: <215@cb.ecn.purdue.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!hansm
From: hansm@cwi.nl (Hans Mulder)
Newsgroups: comp.editors
Subject: Re: formatting in vi
Message-ID: <192@piring.cwi.nl>
Date: 8 Feb 88 17:26:50 GMT
References: <215@cb.ecn.purdue.edu>
Organization: CWI, Amsterdam
Lines: 54
Keywords: vi, *roff, fmt
Summary: It can be done easier