Zap (z)

zap

Syntax:

[line_range]zcccharacter
[line_range]zcd
[line_range]zcDlocation
[line_range]zcelocation
[line_range]zcfcharacter
[line_range]zchlocation
[line_range]zcl
[line_range]zcp
[line_range]zcr
[line_range]zcRnumber
[line_range]zcs
[line_range]zh
[line_range]zkline
[line_range]zlc
[line_range]zld
[line_range]zle
[line_range]zlf
[line_range]zlj
[line_range]zlo
[line_range]zlp
[line_range]zlq
[line_range]zlr
[line_range]zlR["filename"]
[line_range]zls
[line_range]zlt
[line_range]zlu
[line_range]zlw["filename"]
[line_range]zmtext
[line_range]zp
[line_range]zqc
[line_range]zvdigit

Description:

This command consists of a number of useful subcommands which relate directly to the capabilities of a full screen editor. The subgroup starting with zc (Zap Cursor) deal with the cursor and are further subdivided by a third character to indicate a particular function. The line_range for the zc group may be a single line address of zero in which case the command will be applied to the command line instead of the text area. Each Zap function is described in a subsection below.

zcc - Zap Cursor Change
[line_range]zcccharacter

This function changes the character under the cursor to the character specified. The character may not be a \hh escape sequence but may be a carriage return. If option insert is on (i+) then character is inserted before the cursor.

Condition Register: Not affected.

zcd - Zap Cursor Delete
[line_range]zcd

This function deletes the character under the cursor causing the rest of the line to Shift to the left.

Condition Register: Trying to delete a non-existent character (you are to the right of the end of the line) will set the condition register FALSE. A successful delete sets it TRUE.

zcD - Zap Cursor Delete Multiple
[line_range]zcDlocation

This function will delete all characters from the current cursor position to the position specified by location. The location is specified in the same manner as the zch command.

Condition Register: Trying to delete a non-existent character (you are to the right of the end of the line) will set the condition register FALSE. A successful delete sets it TRUE.

zce - Zap Cursor Erase
[line_range]zcelocation

This function will erase all characters from the current cursor position to the position specified by location. This allows erase to end of field (right margin) to be implemented via a

zcer

The location is specified in the same manner as the zch command. If the field does not end the line, the field is replaced with blanks instead of being deleted. This preserves column integrity.

Condition Register: Set TRUE if any characters are erased.

zcf - Zap Cursor Fill
[line_range]zcfcharacter

This function defines the fill character to be used whenever you type a character to the right of your text (indicated by a small centered dot in option blank (b+)). The default is to extend the line with blanks. However it may be changed to any character, a period being a typical example. The character may not be a \hh escape sequence.

The fill character is often changed to a Tab when used in conjunction with the Ctrl-b (begin indent) and Ctrl-e (end indent) keys when writing programs.

Condition Register: Not affected.

zch - Zap Cursor Horizontal
[line_range]zchlocation

This function moves the cursor horizontally on the line. The movement may be absolute, relative or based upon a pattern. The field location determines the type of movement and can be one of:

Location Movement
number Absolute movement to indicated character number.
+number Relative movement forward number characters.
-number Relative movement backward number characters.
$ Move to end of line.
l Move to left margin.
r Move to right margin.
/pattern/ Starting at the current cursor attempt to match the indicated pattern. Note that the line is assumed to start at the cursor and all characters to the left of the cursor are ignored. The pattern /^./ would match the character at the cursor not the beginning of the line. Option anchor will determine the new location of the cursor on a match.
?pattern? Starting at the current cursor and scanning backwards, attempt to match the indicated pattern. Note that the line is assumed to start at the cursor and extend backwards to the beginning of the line. All characters to the right of the cursor are ignored. Due to the backward scan, the line will appear reversed to the pattern. To match the string “IBM” you would specify the pattern ?MBI?. This is only true of backward searches using the zch command.

In all cases above, the cursor is limited to lie between index 1 and 512.

Condition Register: An attempt to move the cursor outside the text on the line (or a pattern match fail) will set the condition register FALSE, otherwise, it is set TRUE.

zcl - Zap Cursor Lock
[line_range]zcl

When the editor is forced to move the cursor to a line which is not within the currently displayed screen, it will by default redisplay with the cursor line positioned at your defined center line (see vcnumber). The Zap Cursor Lock command locks the cursor to the top or bottom of the screen on a redisplay. Conceptually, if your cursor must move off the top of your screen then, it will remain locked at that position and your text will scroll down as required. Likewise, if your cursor must move off the bottom of your screen, then it will remain locked at that position and your text will scroll up as required.

As an example the up-arrow () and down-arrow () are implemented as:

.-1|zcland.+1|zcl

to prevent a re-centering of your display when your cursor attempts to leave the screen.

Condition Register: Not affected.

zcp - Zap Cursor Purge
[line_range]zcp

This command purges all characters in the character delete buffer.

Condition Register: Not affected.

zcr - Zap Cursor Restore
[line_range]zcr

This command causes the last character put in the delete buffer to be restored at the current cursor position. If option insert is on (i+) the character will be inserted before the cursor.

Condition Register: Set TRUE if the character delete buffer contains at least one character to restore.

zcR - Zap Cursor Restore Multiple
[line_range]zcRnumber

This command will restore the last number characters put in the delete buffer at the current cursor position. If option insert is on (o+) the characters will be inserted before the cursor.

Condition Register: Not affected.

zcs - Zap Cursor Save
[line_range]zcs

If the cursor is positioned on a character, then it is saved in the character delete buffer. If the cursor is not on a character (off to the right of the line) then nothing is saved.

The character delete buffer may hold a maximum of 256 characters. Saving more than this number causes any new character to be inserted at the front and the oldest character is lost. Only the last 256 characters are kept.

Condition Register: Set TRUE if a character is saved.

zh - Zap Home
[line_range]zh

This command will move your cursor to the top left hand corner of a tagged block of text. For example, say you wish to write a macro which saves a tagged block of text to a file, executes the sort command and replaces the tagged tagged text when sorted. It is necessary to ensure that the cursor is positioned at the top left corner of the text when you read the file back in.

t \01 \ffzh\0a\ffzp#zlw"tmp"!!sort tmp +r\0a\ffzpzlR"tmp"\0a

Condition Register: Not affected.

zk - Zap Kopy
[line_range]zkline

This command provides a convenient method of kopying a text line to the command line and vise versa. A line address of zero designates the command line. For example:

Kopy command line to current line:

0zk.

Kopy current line to command line:

.zk0

Condition Register: Not affected.

zlc - Zap Line Center
[line_range]zlc

This command will center the text between the left and right margins of the indicated lines.

Condition Register: Not affected.

zld - Zap Line Delete
[line_range]zld

This command will delete the text between the left and right margins of the indicated lines.

Condition Register: Not affected.

zle - Zap Line Erase
[line_range]zle

This command will erase the text between the left and right margins of the indicated lines.

Condition Register: Not affected.

zlf - Zap Line Fill
[line_range]zlf

This command will fill the text between the left and right margins of the indicated lines.

Condition Register: Not affected.

zlj - Zap Line Join
[line_range]zlj

This command will set the join flag on the indicated lines.

Condition Register: Not affected.

zlo - Zap Line Overstrike
[line_range]zlo

This command will set the overstrike flag on the indicated lines.

Condition Register: Not affected.

zlp - Zap Line Paragraph
[line_range]zlp

This command will set the paragraph flag on the indicated lines.

Condition Register: Not affected.

zlq - Zap Line Query
[line_range]zlq

This command will set the condition code TRUE if there are any marks set.

Condition Register: TRUE if any marks set.

zlr - Zap Line Restore
[line_range]zlr

This command will restore the contents of the delete buffer where the current text cursor is. The delete buffer is not affected.

Condition Register: Not affected.

zlR - Zap Line Restore File
[line_range]zlR["filename"]

This command will read the contents of a file into the delete buffer then restore the contents of the delete buffer where the current text cursor is. If no file name is specified, then the file /tmp/groupID.userID will be used where group and member are numbers.

Condition Register: Not affected.

zls - Zap Line Save
[line_range]zls

This command will save the text between the left and right limit at the end of the delete buffer. Limits are set by tags.

Condition Register: Not affected.

zlt Zap Line Tag
[line_range]zlt

This command tags the indicated line if it was untagged and untags it if it was tagged. If there are already two tags in effect then this tag will replace one of the tags. NOTE: If two zlt commands occur within 1/2 second then option limit will be enabled and the line will not be untagged.

Condition Register: Not affected.

zlu - Zap Line Untag
[line_range]zlu

This command removes all tags in the file if any are set or sets the last tags if there are not any tags set. It is a toggle.

Condition Register: Not affected.

zlw - Zap Line Write
[line_range]zlw["filename"]

This command will save the text between the left and right limit at the end of the delete buffer. Limits are set by tags. The data is then saved into a file. If no file name is specified, then the file '/tmp/groupID.userID' will be used where group and member are numbers.

Condition Register: Not affected.

zm - Zap Message
[line_range]zmtext

This command will print the message which follows on the command line. This is useful as a prompt.

Condition Register: Not affected.

zp - Zap Purge
[line_range]zp

This command purges all lines in the line delete buffer.

Condition Register: Not affected.

zq - Zap Query
[line_range]zqc

This command sets the condition code based upon the character which follows the zq. If c may be # or !.

Condition Register:

#
TRUE if any tags have been set
!
TRUE if zero exit status of last command
zv - Zap Version
[line_range]zvdigit

This command sets the condition code based upon the version number of the editor. The version is a number between 0 and 9. If the editors version is greater than or equal to the digit specified the condition code will be set TRUE.

e.g. Set condition code TRUE if editor version 1 or later:

zv1

Condition Register: TRUE if editor is greater than or equal to the indicated version.

Current line:

In all cases, it is set to the last line of the specified range; however, not all Zap commands use the line range information (zp for example).

Condition register:

Depends on the specific Zap command; see description.