1BSD/exrefm/exrefm6.n

.if !\n(xx .so tmac.e
.SH
Command descriptions
.PP
In the following command descriptions, the
default addresses are shown in parentheses,
which are
.I not ,
however,
part of the command.
The variant flags
.I ! ,
.I counts
and
.I flags
are always optional.
.LC
.nf
( \fB.\fR ) \fBappend\fR \fI!\fR
.br
\fItext\fR
.br
\&\fB.\fR
.fi
.HP
The
.I append
command reads the input text and places it after the specified line.
After the command, `\fB.\fR'
addresses the last line input or the
specified line if no lines were input.
If address `0' is given,
text is placed at the beginning of the buffer.
The variant flag toggles the setting for
.I autoindent
during the input of
.I text .
.LC
.nf
\fBargs\fR \fI!\fR
.fi
.HP
The members of the argument list are given starting with the current
one or, if the variant is given, starting with the beginning of
the argument list.
.LC
.nf
\fBcd\fR \fIdirectory\fR
.fi
.HP
The
.I cd
command is a synonym for
.I chdir .
.LC
.nf
( \fB.\fR , \fB.\fR ) \fBchange\fR \fI!\fR \fIcount\fR
.br
\fItext\fR
.br
\&\fB.\fR
.fi
.HP
The
.I change
command replaces the specified lines with the input \fItext\fR.
The current line becomes the last line input;
if no lines were input it is left as for a
\fIdelete\fR.
The variant toggles
.I autoindent
as in a
.I append .
.LC
.nf
\fBchdir\fR \fIdirectory\fR
.fi
.HP
The specified \fIdirectory\fR becomes the current directory.
If no directory is specified, the current value of the
.I home
option is used as the target directory.
After a
.I chdir
the current file is not considered to have been
.I edited
so that write restrictions on pre-existing files apply.
.LC
.nf
( \fB.\fR , \fB.\fR )\|\fBcopy\fR \fIaddr\fR \fIflags\fR
.fi
.HP
A
.I copy
of the specified lines is placed after
.I addr ,
which may be `0'.
The current line
`\fB.\fR'
addresses the last line of the copy.
The command
.I transcribe ,
`t',
is a synonym for
.I copy .
.LC
.nf
( \fB.\fR , \fB.\fR )\|\fBdelete\fR \fIcount\fR \fIflags\fR
.fi
.HP
The
.I delete
command removes the specified lines from the buffer.
The line after the last line deleted becomes the current line;
if the lines deleted were originally at the end,
the new last line becomes the current line.
.LC
.nf
\fBecho\fR \fItext\fR
.fi
.HP
.I Text
is echoed onto the standard output up to a `|' or newline character.
These (and any) characters may be included in
.I text
by preceding them with a `\e'.
Initial blanks are stripped from \fItext\fR.
.LC
.nf
\fBedit\fR \fI!\fR \fIfilename\fR
.br
\fBex\fR \fI!\fR \fIfilename\fR
.fi
.HP
The
.I edit
command is used to begin an editing session on a new file and is
composed of several distinct actions.
.I Edit
first checks to see if the buffer has been modified since the last
.I write
command was issued.
If it has been,
a warning is issued and the
.I edit
command is never begun.
In this case, the user has a second and last chance to write out the
buffer.
If another
.I edit
(or
.I next
or 
.I quit)
command is executed without a
.I write
and before any further modifications to the buffer,
the editing changes to the buffer will be lost.
This entire warning procedure is suppressed if the variant flag is given.
.IP
The
.I edit
command next deletes the entire contents of the editor buffer
making the named file the current file and printing its name.
After insuring that this file is sensible,
i.e. that it is not a binary file such as a directory,
a block or character special file other than
.B /dev/tty ,
a terminal,
or a binary or executable file
(as indicated by the first word),
.I ex
reads the file into the editor buffer.
.IP
If the read of the file completes without error,
the number of lines and characters read is typed.
If there were any dirty (non-\s-2ASCII\s0) characters
in the file they are stripped of their non-\s-2ASCII\s0
high bits,
and any null characters in the file are discarded.
If none of these errors occurred, the file is considered
.I edited .
If the last line of the input file is missing the trailing
newline character, it will be supplied and a complaint will be issued.
This command leaves the current line `\fB.\fR' at the last line read.
.LC
.nf
( \fB.\fR , \fB.\fR ) \fBexpand\fR \fI!\fR \fIcount\fR \fIflags\fR
.fi
.HP
The
.I expand
command processes the text of the specified lines,
converting tabs to an appropriate number of spaces.
The current line is left at the last line which had a tab expanded.
.LC
.nf
\fBfile\fR
.fi
.HP
The current filename is displayed along with an indication of whether
it is considered `[Edited]',
whether it has been `[Modified]' since the last
.I write 
command,
and the number of lines in the buffer.
.LC
.nf
\fBfile\fR \fIfilename\fR
.fi
.HP
The current file is changed to
.I filename
which is not considered 
.I edited .
.LC
.nf
( 1 , $ ) \fBglobal\fR \fI!\fR /\fIpat\|\fR/ \fIcmds\fR
.fi
.HP
The
.I global
command first marks each line among those specified which matches
the given regular expression.
Then the given command list is executed with `\fB.\fR' initially
set to each marked line.
In the variant form the list is executed at each line not matching
the given regular expression.
.IP
The command list consists of the remaining commands on the current
input line and may continue to multiple lines by ending all but the
last such line with a `\e'.
.I Append ,
.I insert ,
and
.I change
commands and associated input are permitted;
the `\fB.\fR' terminating input may be omitted if it would be on the
last line of the command list.
.I Open
and
.I visual
commands are permitted in the command list and take input from the terminal.
.IP
The
.I global
command itself may not appear in
.I cmds.
The
.I undo
command is also not permitted there,
as
.I undo
instead can be used to reverse the entire
.I global
command.
The options
.I autoprint
and
.I autoindent
are inhibited during a
.I global ,
and the value of the
.I notify
option is temporarily infinite,
in deference to a \fInotify\fR for the entire global.
Finally, the context mark `\'\'' is set to the value of
`.' before the global command begins and is not changed during a global
command,
except perhaps by an
.I open
or
.I visual
within the
.I global .
.LC
.nf
\fBhelp\fR \fItopic\fR
.fi
.HP
The 
.I help
command accepts keywords related to the editor and,
if there is information in its data base about that
.I topic
supplies the information.
A list of topics can be had by
.I help\ index .
The data files for help are kept in the directory
.B /usr/lib/how_ex .
.LC
.nf
( \fB.\fR )\|\fBinsert\fR \fI!\fR
.br
\fItext\fR
.br
\&\fB.\fR
.HP
The
.I insert
command places the given text before the specified line.
The current line is left at the last line input;
if there were none input it is left at the line before the addressed line.
This command differs from
.I append
only in the placement of text.
The variant toggles
.I autoindent
during the
.I insert .
.LC
.nf
( \fB.\fR , \fB.\fR+1 ) \fBjoin\fR \fI!\fR \fIcount\fR \fIflags\fR
.fi
.HP
The
.I join
command places the text from a specified range of lines
together on one line.
White space is adjusted at each junction to provide at least
one blank character.
If there is already white space at the end of the line,
then the white space at the start of the next line will be discarded.
The variant causes a simpler
.I join
with no white space processing.
.LC
.nf
( \fB.\fR ) \fBk\fR \fIx\fR
.fi
.HP
The
.I k
command is a synonym for
.I mark .
.LC
.nf
( \fB.\fR , \fB.\fR ) \fBlist\fR \fIcount\fR \fIflags\fR
.fi
.HP
The
.I list
command prints the specified lines in a more unambiguous way;
non-graphic characters are escaped in octal,
tabs and backspaces are printed as
\o'>\-' and
\o'<\-'
with the overstruck
`\-' being omitted if the terminal can not overstrike.
The end of each line is marked with a trailing `$'.
The current line is left at the last line printed.
.LC
.nf
( \fB.\fR ) \fBmark\fR \fIx\fR
.fi
.HP
The
.I mark
command gives the specified line mark
.I x ,
a single lower case letter.
(The
.I x
must be preceded by a blank or a tab.)
Subsequently, the addressing form `\'x' addresses this line.
The current line is not affected by this command.
.LC
.nf
( \fB.\fR , \fB.\fR ) \fBmove\fR \fIaddr\fR
.fi
.HP
The
.I move
command repositions the specified lines after
.I addr .
The first of the moved lines becomes the current line.
.LC
.nf
\fBnext\fR \fI!\fR
.fi
.HP
The next file from the command line argument list is edited.
The variant suppresses ``No write since last change''
warnings before performing the 
.I next
as for the
.I edit
command.
.LC
.nf
\fBnext\fR \fI!\fR \fIfilelist\fR
.fi
.HP
The specified
.I filelist
is expanded and the resulting list replaces the
current argument list;
the first file in the new list is then edited.