If you could have anything in vi ...

Rouben Rostamian rouben at math13.math.umbc.edu
Thu Mar 21 21:54:06 AEST 1991


>In <1991Mar18.195343.665 at cs.widener.edu> brendan at cs.widener.edu (Brendan Kehoe) writes:
> I'm working on a "free" version of vi. It's to fully emulate the
>current Berkeley-derived versions. After that, it's prettymuch a
>free-for-all.
> So .. what would you have added to vi, if you could? What would you
>have made an option? What would you change?


Here's my two cents:  I would love to have macros which accept arguments,
as in:

map v(arg) Do-this-and-that-with-arg

To use the macro, the user presses v, and vi prompts for the arg.

Example:

map #i(x) :'m,.s/^/x /

Note that "x" takes on a special meaning in the substitute portion of this
macro;  it stands for a variable, not a literal "x".  A literal "x"
should be quoted, as in "\x", to override the macro substitution.
This macro says that [from the point marked "m"] to [the current line]
insert "x " in the beginning of each line, where x is to be specified.

For instance, to comment-out a block of text in a fortran program, I can
mark the beginning of the range with m, move to the end of the range,
type #i, at which point vi will prompt me for the argument, I will type C,
and then the macro will do the rest.

The very same macro may be used to comment out a block of text in a 
TeX document; just respond with % to the prompt.  In a sh or csh script
respond with #.   To insert "> " markers in replying to someone's
mail, respond with >.  

To un-comment a block of text, I would use the companion macro:

map #r(x) :'m,.s/^..//

--
Rouben Rostamian                          Telephone: (301) 455-2458
Department of Mathematics and Statistics  e-mail:
University of Maryland Baltimore County   bitnet: rostamian at umbc.bitnet
Baltimore, MD 21228,  U.S.A.              internet: rouben at math9.math.umbc.edu



More information about the Comp.unix.misc mailing list