Search                        Top                                  Index
HELP VEDMACROS                                  Aaron Sloman April 1982

--- DEFINING NEW EDIT COMMANDS IN VED --------------------------------

It is possible, if you know about the VED system procedures, (summarised
in REF * VEDPROCS) to define a new commmand, e.g. <ENTER> FOO, by
defining a procedure called VED_FOO and making use of the VED system
procedures. If the definition is put into your file VEDINIT.P then it
will be automatically loaded when you use VED.

For most users it will be more convenient to use the <ENTER> DM command.
This will automatically create and load a procedure for you in your
VEDINIT.P file. E.g. suppose you frequently mistype 'define' as 'dfine'
and want to have a new command called FIX, which will to a global
substitution for you. You can do the followingl

        <ENTER> dm fix <RETURN>

VED will then get your VEDINIT.P file (creating a new one if necessary),
and start defining the procedure VED_FIX in it. Half way through it will
stop and put a message on the command line, telling you to press keys
and terminal with <ESC> pressed three times. At this point you press all
the keys that you would have to press to give the command directly. I.e.
press <ENTER>, then type

        gs/dfine/define

then press <RETURN> then, to show that you have finished, press <ESC>
three times. The definition of VED_FIX will then be completed, and
loaded, and your VEDINIT.P file will be written.

Some of the characters you type will go into the procedure definition
just as you type them. A lot of 'special' characters will appear in
forms like

        \^[  or \^M or \^H

These are representations of 'control characters'. (See HELP ASCII).
E.g. on the Visual 200 terminal, pressing the <ENTER> button will cause

        \^[?M

to go into the string. So if you press it by mistake, you'll have to
delete all five of those characters (see below). Some keys will cause
only three characters to go in, and some only two.

If you make a mistake while defining the macro, you can delete the last
character by pressing <ESC> then <DEL>. If you have to delete five
characters, then press <ESC> <DEL> five times.

If you just press <DEL> then the character will go into the file,
represented as '\^?'. When the procedure runs this will have the same
effect as pressing the <DEL> button.

When you've completed the definition, you'll find that typing

        <ENTER> fix <RETURN>

is the same as typing

        <ENTER> gs/dfine/define <RETURN>

Later, if you want to edit the procedure, you can use VED on your
VEDINIT.P file, and edit it as usual. If you alter any of the 'special'
character sequences, make sure you know what you are doing.

See also
    HELP * VEDINPUT
    HELP * VEDSETKEY
    HELP * DK


--- C.all/help/vedmacros
--- Copyright University of Sussex 1989. All rights reserved. ----------