[comp.editors] macros in vi

gene@ntvax.uucp (Gene De Lisa) (11/10/89)

could someone tell me how to use @ macros in vi?
the manual i have says follow the @ with the name of a buffer.
how do you get the macro into the buffer in the first place
(besides typing them in and yanking them). i suspect that
you might be able to do it with so.
anyone know?
-- 
Gene De Lisa

gene@dept.csci.unt.edu

maart@cs.vu.nl (Maarten Litmaath) (11/14/89)

In article <1989Nov10.015031.21474@ntvax.uucp> gene@ntvax.UUCP (Gene De Lisa) writes:
\could someone tell me how to use @ macros in vi?
\the manual i have says follow the @ with the name of a buffer.
\how do you get the macro into the buffer in the first place
\(besides typing them in and yanking them). [...]

Correct.  Quoted from the Vi Reference (email if you missed it):

    @<a-z>                  | Consider the contents of the named register a
                            | command, e.g.:
                            |       o0^D:s/wrong/good/<esc>"zdd
                            | Explanation:
                            |       o              - open a new line
                            |       0^D            - remove indentation
                            |       :s/wrong/good/ - this input text is an
                            |                        `ex' substitute command
                            |       <esc>          - finish the input
                            |       "zdd           - delete the line just
                            |                        created into register `z'
                            | Now you can type `@z' to substitute `wrong'
                            | with `good' on the current line.
    @@                      | Repeat last register command.

If you want to set such a macro in EXINIT/.exrc:

	map @a ...
-- 
"Richard Sexton is actually an AI program (or Construct, if you will) running
on some AT&T (R) 3B" (Richard Brosseau) | maart@cs.vu.nl, mcsun!botter!maart

sanders@sanders.austin.ibm.com (Tony Sanders) (11/15/89)

In article <4528@ski.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>In article <1989Nov10.015031.21474@ntvax.uucp> gene@ntvax.UUCP (Gene De Lisa) writes:
>\could someone tell me how to use @ macros in vi?
>\the manual i have says follow the @ with the name of a buffer.
>\how do you get the macro into the buffer in the first place
>\(besides typing them in and yanking them). [...]
Yep, you have to _virtually_ type them in and yank them.  Meaning you can
map a key to do it for you BUT! this causes your file to be [edited].
I've long anguished over that fact that you cannot set/append named buffers
without "editing" your file.
For example:

"       find current word as tag (should be ^] and sadly modifies your file)
"       This is a very simple idea of a word.  More complex patterns work also
map ** mq:co.^V^M`qd0:s/^\([a-zA-Z_]*\).*/:ta \1/^V^M"wdd@w

The vi I currently use doesn't support ^] (I'm trying to get a reasonable
vi to compile on my rt runing AIX 2.2.1 :-() so I'm forced to use this
hack which touches my .c files.

>If you want to set such a macro in EXINIT/.exrc:
>
>	map @a ...
I don't believe this is true on various vi's I've tried.
This simply maps the sequence @a to "..."
Am I wrong/confused or were you just thinking out of context???

-- sanders

gene@ntvax.uucp (Gene De Lisa) (11/16/89)

In article <4528@ski.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>In article <1989Nov10.015031.21474@ntvax.uucp> gene@ntvax.UUCP (Gene De Lisa) writes:
>
>Correct.  Quoted from the Vi Reference (email if you missed it):

I tried both addresses and they bounced back so here is a public thank you.
If you do have a copy of the reference could you please forward me a copy?
thanks!

-- 
Gene De Lisa

gene@dept.csci.unt.edu