Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ hed(1) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctags(1)

regcmp(3X)

terminfo(4)

hed(1)  —  CX/UX

NAME

hed − full screen, multiple file editor

SYNOPSIS

hed filename [ r ] [ n1 ] [ pattern ]
hed −t tag [ r ]
hed −r
hed −e

DESCRIPTION

hed is a full screen editor which allows scrolling, multiple edit sessions, buffer editing, walkback and walkforward on a line-by-line basis as well as standard editing functions supported by any text editor.  It is intended to edit ascii files on various terminals via terminfo(4). The environment variable TERM is read for the terminal type. 

The options are :

−e Eliminate hed work files and exit.  This is useful when recovery fails. 

−r Recover a previous edit session. 

−t tag Edit the file containing the tag and position the editor at its definition (see ctags(1)).

The parameters are :

filename Name of the file to edit. 

r Edit the file read only. 

n1 List to line number n1 after initialization. 

/pattern Search for pattern after initialization.  Pattern is a regular expression in the style of ed(1) and regcmp(3X).

Command Mode

In the description below, n1, n2 and n3 are line numbers.  C1 and c2 are column numbers.  In some cases, you can use the box instead of line numbers.  The character . can be used to indicate the line at the top of the screen.  The character $ can be used to indicate the last line of the file.  If a column range is omitted, the default is the entire line.  Environment variables are interpreted in file names. 

c
up arrow

down arrow Enter screen mode.  In screen mode, the characters you type become part of the file.  You can return to command mode by pressing control-z (hold down the control key and press "z"). 

Note: in "g" mode, up arrow and down arrow move within the list of previous commands rather than entering screen mode.  See the "g" command. 

+[n1] List forward. 

−[n1] List backward. 

null command List the next page in the current direction. 

n1 List beginning at line n1. If n1 is greater than the number of lines in the file, the last page is listed. 

[n1[,n2]] i n3 [filename]
Insert lines n1 through n2 from filename after line n3. If the line range is not specified, the entire file is inserted. If filename is not specified, the current edit file is inserted.  If neither is specified, and the box is set, the box is inserted. 

[n1[,n2]] d Delete lines n1 through n2. If the box is set, the line range defaults to the box.

n1[,n2] m n3 Move lines n1 through n2 after line n3.

[n1[,n2]] /pattern/ [c1[,c2]]
Search forward for pattern. If n2 is not specified, the end of the range defaults to $.  Pattern is a regular expression (see ed(1),regcmp(3X)). 

?pattern? [c1[,c2]] Search backward for pattern.

/ Find next occurrence of pattern.

? Find previous occurrence of pattern.

[n1[,n2]] /pattern/ [c1[,c2]] ∗
Find all occurrences of pattern. If n2 is not specified, the end of the range defaults to $.  Return to the edit session by pressing control-z. 

[n1[,n2]] s /pattern/text/ [c1[,c2]]
Substitute text for pattern. If the box is set, the line range defaults to the box.

[n1[,n2]] cc /text/ c1[,c2]
Column change. Change columns c1 through c2 to text. If the box is set, the line range defaults to the box.

[n1[,n2]] cd c1[,c2]
Column deletion. Delete columns c1 through c2. If the box is set, the line range defaults to the box.

[n1[,n2]] ci /text/ c1
Column insertion. Insert text before column c1. If the box is set, the line range defaults to the box.

b [n] Walk back.  The file reverts to its state before the preceding n changes.  N defaults to 1.  A change is a single command (in command mode), or the changes to a single line (in screen mode). 

f [n] Walk forward.  N changes are restored.  N defaults to 1.  Note that if you walk back and then make a change, the changes you walked back from are lost. 

quit Quit without updating.  The session is closed and the file is not modified.  If this is the last session, hed exits. 

w [filename] Write.  If no filename is specified, the original file is updated, the session is closed, and, if this is the last session, hed exits.  The file is updated by writing to a temporary file and renaming it.  The name of the temporary file is the same as the edit file, with a "#" on the end.  For example, the temporary file for /usr/fred/myfile.c would be /usr/fred/myfile.c#. 

If a filename is specified, the updated file is written to filename, the original file is not modified, and the session is left open.

e filename [r] [n1] [/pattern]
Edit filename. Preserve the current session and open a new session for filename.

n [n] Next session.  Preserve the current session and reopen another session.  If n is specified, edit session n is reopened. 

l filename [n1] [/pattern]
List filename. This is functionally equivalent to "e filename r [n1] [/pattern]"

ta tag [r] Edit file containing tag (see ctags(1)).

z Edit the buffer.  A new session is opened for the buffer.  Any editing commands can be used in this session, except for "buffer move," "buffer append" and "buffer copy."

help Help command.  A special edit session is set up for a file containing information about how to use hed.  You can practice editing in this session.  You can leave the help session by using quit or n. 

. Print current line range displayed. 

t n Set tab stops every n columns. 

jcl Escape to the shell.  You can return to hed by using the −r option. 

!command Run command in a shell.  After the command has completed, you can return to the edit session by pressing control-z. 

st File status is displayed.  Return to the edit session by pressing control-z. 

c∗ Show lines new to this session.  Return to the edit session by pressing control-z. 

readtf filename Read the template file filename.

writetf filename Write all the defined templates to filename.

[n] g [/pattern] Enter "g" mode.  The nth most recent command that matches pattern is retrieved and placed on the command line.  The command may then be modified, if desired, and submitted by pressing return.  If no pattern is present, then any command matches.  The default repeat count is 1.  Therefore, g by itself retrieves the most recent command. 

In "g" mode the up arrow and down arrow keys cause less recent and more recent commands, respectively, to be retrieved.  Control-f searches the commands, from the current position, using the most recent pattern. Function key 15 also searches from the current position, but prompts for a new pattern. The pattern for searching in commands is maintained separately from the pattern for searching in the text of the file. Searches in "g" mode are always from the most recent to the least recent commands. Only the most recent hundred or so commands are kept.

Screen Mode

Screen mode allows you to enter text directly.  You can use the terminal’s cursor control keys and editing keys, including "home", "tab", "backtab", "insert character", "delete character", "insert line", "delete line" and "clear to end of line".  In addition, there are several special commands using control keys and function keys.  In the following commands, control-x means to hold down the control key and press the x key. 

control-z Leave screen mode and enter command mode. 

control-n Next session. 

control-] Edit the file containing tag. Tag is the word where the cursor is positioned. 

control-f Find next occurrence of the current pattern. The find is from the current cursor position and in the current list direction. The cursor is placed on the beginning of the matching string.

control-d Change list direction. 

control-c Move the cursor to the first non-white space on the next line. 

carriage return Open a new line below the current line.  The cursor is positioned below the first non-white space on the current line. 

control-w Move the cursor to the next word.  Words are separated by white space. 

control-e Move the cursor to the previous word. 

control-t Define template.  hed searches backward on the current line for a token, delimited by white space, which becomes the name of the template to be defined.  Keystrokes are saved up until another control-t. 

control-p Insert template.  The name of the template is found the same way as with "define template." The remembered keystrokes are repeated as if they had been typed in.  A template insertion is considered to be a single change by b and f. 

In the following commands, fn stands for function key n.

f1  Refresh screen The screen is cleared and redrawn. 

f2  Print file position The line and column number where the cursor is positioned are printed to the status line. 

f3  Restore split line The line below the current line is moved to the end of the current line.  (See "split line" below.) 

f4  Split line The contents of the line from the cursor to the end of the line are moved to a new line below the current line. 

f5  Box delete Deletes the lines from the current line to the previously set box limit.  (See "set box" below.) 

f6  Buffer move Deletes the lines from the current line to the previously set box limit.  The lines become the new contents of the buffer.  (See "set box" below.) 

f7  Buffer append Similar to "buffer copy," except that the lines are added to the end of the buffer.  (See "buffer copy" and "set box" below.) 

f8  Buffer copy The lines from the current line to the previously set box limit are copied into the buffer.  (See "set box" below.) 

f9  Set box This sets the first box limit for use with "box delete," "buffer move," "buffer append" and "buffer copy." "B1" appears on the status line.  If a box limit already exists, this command sets a second box limit, thereby defining a box of text for use with i, d, s, cc, cd and ci. 

f10  Target Insert the contents of the buffer after the current line. 

f11  Beginning of line Move the cursor to the first non-white space character on the current line. 

f12  End of line Move the cursor after the last non-white space character on the current line. 

f13  List forward List forward one page. 

f14  List backward List backward one page. 

f15  Find hed prompts you for pattern. The find is from the current cursor position and in the current list direction. The cursor is placed on the beginning of the matching string.

f16  Box, buffer cancel Cancel the box and the buffer.  The box limits are removed and the buffer is considered to be empty. 

FILES

filename# temporary file during update

/var/hed/bf00 uid for buffer manipulations

/var/hed/cf00 uid holds changed lines

/var/hed/rf nnuid recovery information for file nn

tags tag information

SEE ALSO

ctags(1), regcmp(3X), terminfo(4). 
Harris Editor User’s Guide.

DIAGNOSTICS

Exit status is:

0ended with a w command. 

1ended with a jcl command. 

2ended with a quit command. 

3initialization error. 

BUGS

Text of long lines will only be displayed up to the column width of the terminal. 
 

HED User’s Guide

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026