Xref: utzoo comp.editors:2769 comp.unix.misc:1154 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!gatech!mcnc!uvaarpa!haven!umbc3!math13.math.umbc.edu!rouben From: rouben@math13.math.umbc.edu (Rouben Rostamian) Newsgroups: comp.editors,comp.unix.misc Subject: Re: If you could have anything in vi ... Message-ID: <5489@umbc3.UMBC.EDU> Date: 21 Mar 91 11:54:06 GMT References: <1991Mar18.195343.665@cs.widener.edu> <7214@ecs.soton.ac.uk> <7220@ecs.soton.ac.uk> <1991Mar21.065353.1341@cs.ucla.edu> Sender: newspost@umbc3.UMBC.EDU Reply-To: rouben@math13.math.umbc.edu.UUCP (Rouben Rostamian) Organization: Mathematics Department University of Maryland, Baltimore County Lines: 44 >In <1991Mar18.195343.665@cs.widener.edu> brendan@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@umbc.bitnet Baltimore, MD 21228, U.S.A. internet: rouben@math9.math.umbc.edu