is the root of a family of editors:
is a superset of
with the most notable extension being a display editing facility.
If you have a CRT terminal, you may wish to use a display
based editor; in this case
ex processes supplementary code set characters
according to the locale specified in the LC_CTYPE
environment variable (see LANG on
In regular expressions, pattern searches are performed
on characters, not bytes, as described on
For ed users
If you have used
you will find that,
in addition to having all of the
has a number of additional features useful on CRT terminals.
Intelligent terminals and high speed terminals are very pleasant to use
editor uses far more of the capabilities of terminals than
does, and uses the terminal capability data base
and the type of the terminal you are using from the environment variable
to determine how to drive your terminal efficiently.
The editor makes use of features such as insert and delete character and line
(which can be abbreviated vi)
and which is the central mode of editing when using the
contains a number of features for easily viewing the text of the file.
command gives easy access to windows of text.
(control-d) causes the editor to scroll a half-window of text
and is more useful for quickly stepping through a file than just typing
Of course, the screen-oriented
mode gives constant access to editing context.
gives you help when you make mistakes.
command allows you to reverse any single change which goes astray.
gives you a lot of feedback, normally printing changed lines,
and indicates when more than a few lines are affected by a command
so that it is easy to detect when a command has affected more lines
than it should have.
The editor also normally prevents overwriting existing files, unless you
edited them, so that you do not accidentally overwrite
a file other than the one you are editing.
If the system (or editor) crashes, or you accidentally hang up the line,
you can use the editor
to retrieve your work.
This will get you back to within a few lines of where you left off.
has several features for dealing with more than one file at a time.
You can give it a list of files on the command line
and use the
(n) command to deal with each in turn.
command can also be given a list of file names, or a pattern
as used by the shell to specify a new set of files to be dealt with.
In general, file names in the editor may be formed with full shell
The metacharacter `%' is also available in forming file names and is replaced
by the name of the current file.
The editor has a group
of buffers whose names are the ASCII lower-case letters
You can place text in these named buffers
where it is available to be inserted elsewhere in the file.
The contents of these buffers remain available when you begin editing a new file
There is a command
which repeats the last
In addition, there is a
confirmed substitute command.
You give a range of substitutions to be done and the editor interactively
asks whether each substitution is desired.
It is possible to ignore the case
of letters in searches and substitutions.
also allows regular expressions which match words to be constructed.
This is convenient, for example, in searching for the word
``edit'' if your document also contains the word ``editor.''
has a set of
which you can set to tailor it to your liking.
One option which is very useful is the
option that allows the editor to supply leading white
space to align text automatically.
You can then use
as a backtab
and space or tab to move forward to align new code easily.
Miscellaneous useful features include an intelligent
(j) command that supplies white space between joined lines
commands < and > which shift groups of lines,
and the ability to filter
portions of the buffer through commands such as
The following invocation options are interpreted by
(previously documented options are discussed in the
section at the end of this manual page):
Suppress all interactive-user feedback.
This is useful in processing editor scripts.
Edit the file containing the
and position the editor at its definition.
Note: tags in the tag file must be in
after an editor or system crash.
(Recovers the version of
that was in the buffer when the
List the names of all files saved as the
result of an editor or system crash.
flag is set, preventing accidental
overwriting of the file.
Encryption option; when used,
command and prompts the user for a key.
This key is used to encrypt and decrypt
text using the algorithm of the
makes an educated guess to determine whether text
read in is encrypted or not.
The temporary buffer file is encrypted also,
using a transformed version of the key
typed in for the
Also, see the
section at the end
of this manual page.
Encryption option; the same as the
option, except that
command is like the
all text read in is assumed to have been encrypted.
Begin editing by executing the specified editor
(usually a search or positioning command).
argument indicates one or more files to be edited.
Normal and initial state.
Input prompted for by :.
Your line kill character cancels a partial command.
Entered by a, i, or c.
Arbitrary text may be entered.
Insert state normally is terminated by a line having only "``.''"
or, abnormally, with an interrupt.
Entered by typing vi; terminated by typing Q
or ^e (<Ctrl>-e).
ex command names and abbreviations
ex command addresses
Next with pat
Previous with pat
n before x
x through y
Marked with x
Place sets here in environment variable
Editor initialization file
Editor initialization file
Enable option x
Disable option x
Give value val to option x
Show changed options
Show all options
Show value of option x
Most useful options and their abbreviations
Write before changing files
Pathname of directory for temporary work files
Allow vi/ex to read the .exrc
in the current directory; the file must be owned by the invoking user
and writable only by the invoking user, or it is ignored.
This option is set in the EXINIT shell variable
or in the .exrc file in the $HOME directory
Ignore case of letters in scanning
Print ``^I'' for tab, $ at end
Treat ``. [ *'' special in patterns
First five lines and last five lines executed as
vi/ex commands if they are of the form
Macro names that start paragraphs
Simulate smart terminal
Informs you if the number of lines modified
by the last command is greater than the
value of the report variable
Command mode lines
Macro names that start sections
For < >, and input ^D
To ) and } as typed
Show insert mode in vi
Stop updates during insert
Visual mode lines
Automatic line splitting
Search around end (or beginning) of buffer
Scanning pattern formation
Beginning of line
End of line
Beginning of word
End of word
Any character in str
Any character not in str
Any character between x and y
Any number of preceding characters
describes capabilities of terminals
editor startup file
editor startup file
named buffer temporary
language-specific message file (See LANG on
Several options, although they continue to be supported,
have been replaced in the documentation by options that follow
the Command Syntax Standard (see
option has been replaced by
option that is not followed
with an option-argument has been replaced by
has been replaced by
The encryption options and commands are provided
with the Encryption Utilities package,
which is available only in the United States.
command prints the number of logical rather than physical lines.
More than a screen full of output may result if long lines are present.
File input/output errors do not print a name
if the command line -s option is used.
There is no easy way to do a single scan ignoring case.
The editor does not warn if text is placed in named buffers
and not used before exiting the editor.
Null characters are discarded in input files
and cannot appear in resultant files.