Newsgroups: comp.editors
Path: utzoo!lsuc!jmm
From: jmm@lsuc.on.ca (John Macdonald)
Subject: Re: vi Alternative Required (long posting)
Message-ID: <1990Dec8.030816.12253@lsuc.on.ca>
Organization: (guest of) Law Society of Upper Canada, Toronto
References: <1616@ukpoit.co.uk> <joshi.660440350@m.cs.uiuc.edu> <4629@umbc3.UMBC.EDU>
Date: Sat, 8 Dec 90 03:08:16 GMT

In article <4629@umbc3.UMBC.EDU> rouben@math13.math.umbc.edu.UUCP (Rouben Rostamian) writes:
>In article <joshi.660440350@m.cs.uiuc.edu> joshi@cs.uiuc.edu (Anil Joshi) writes:
>>Talking about ex, one can use abbreviations to do a lot of good stuff but the
>>ex macros (I am calling the abbreviations macros) are also key stroke
>>dependent (like having to hit ctrl-v before inserting other control
>>chars. into the macro.). Is there some way of getting parameters to the
>>macros?
>
>No.

Actually, yes, it is possible.  I have not had occassion to have done
it, but a few (very messy) macros could do the following
(not in proper format, just an outline of how it could be done)

<start-args>
    remember current position
    start collecting text for next arg

<next-arg>
    stop collecting text and put it into the next buffer
    start collecting text for next arg

<finish-args>
    stop collecting text and put it into the next buffer
    go back to original position

(I have left out a lot of detail - in particular, keeping track of the
"next buffer" would be done by having <start-args> initialize a control
buffer to the list of buffer names to be used [e.g. "abcdef"], and putting
text into the next buffer requires getting the control buffer, deleting
the first character and returning the rest, building a command [using the
deleted next buffer character] that will delete the collected text into
the buffer.)

Now it is just a matter of writing macros that expect their arguments
in the proper named buffers.

This requires dedicating a number of named buffers and named marks to
this operation.

>>Another problem which I have not solved yet is that while I am editing a
>>file and want to change my function keys, can I run some other .exrc
>>like file from inside the editor? I can do it the long way by typing in
>>all the map commands but I think there must be a short cut to this.
>>There must be, if these editors are as powerful as you claim them to
>>be. It is definitely not exotic.
>
>Yes.
>:source filename

If you do this a lot, it could be useful to define a macro in your
.exrc that generates ":source /usr/home/fred/lib/vi.macros/" so that
you can have a library of sourcable vi definition files accessible
wherever you are.  If you only have a few of these, you could set
up a sep1M~varate macro to fully invoke each one, complete with
the terminating newline.
