The ZEDIT command invokes the editor specified by the EDITOR environment variable for GT.M and opens the specified file for editing. If the EDITOR environment variable is undefined, ZEDIT tries to invoke the UNIX vi editor.
By default, ZEDIT puts a new file into the first source directory in $ZROUTINES. You can specify a file path explicitly in the argument to the ZEDIT command, for example: the current working directory:
ZEDIT "./file"
The format of the ZEDIT command is:
ZED[IT][:tvexpr] [expr[,...]]
The optional truth-valued expression immediately following the command is a command postconditional that controls whether or not GT.M executes the command.
The optional expression(s) specifies the name of a file to edit; note the argument is an expression rather than a routinename; ZEDIT rejects arguments with a file extension of .o as illegal. A valid GT.M file name with no extension will be given an extension of .m; therefore it is not possible, through ZEDIT, to edit a file with a valid GT.M filename and no extension.
If ZEDIT has an argument, it not only invokes the editor, but also sets $ZSOURCE=expr.
If ZEDIT has no argument or expr="", the command acts as a ZEDIT $ZSOURCE; at least two (2) spaces must follow a ZEDIT command with no argument to separate it from the next command on the line.
GT.M stores source code in files with standard operating system format; generally the file name is the same as the GT.M routinename with a default extention or type of .m.
An indirection operator and an expression atom evaluating to a list of one or more ZEDIT arguments form a legal argument for a ZEDIT
If the expression includes a directory, ZEDIT searches only that directory. If $ZROUTINES is not null, a ZEDIT command that does not specify a directory uses $ZROUTINES to locate files. If $ZROUTINES is equal to an empty string, ZEDIT edits a file in the current working directory. For more information on $ZROUTINES, see the appropriate section in Chapter 8: “Intrinsic Special Variables”.
When the argument to a ZEDIT includes a file or path name, $ZSOURCE maintains that as a default for ZEDIT and ZLINK. For more information on $ZSOURCE see the appropriate section in Chapter 8: “Intrinsic Special Variables”.
Example:
GTM>ZEDIT "BAL"
This invokes the editor for a file with a name of BAL and an extension of .m. Notice that BAL is a string literal.
Example:
GTM>Set prog="BAL" GTM>ZEDit prog
This is similar to the first example except that it uses a variable argument rather than a string literal.
Example:
GTM>zedit ".login"
This invokes the editor for a file with the name .login. Notice that in this case the file is not a GT.M file, since .login starts with a period, and therefore, cannot be a GT.M file.