Summary of Modes
Modes are often said to be a Bad Thing.
Se
has lots of modes and this section describes them.
The three main modes are command mode, append mode and overlay mode.
These modes correspond to the activities of entering commands, entering
text and editing text, respectively.
The other modes are switched on and off by options and affect the
overall operation of
se.
Command mode
This is the mode that
se
starts up in.
All the editor commands operate in this mode.
Use the a or i commands to get into append mode,
or the v command to get into overlay mode.
The quit command, q, exits from command mode and returns
control to the operating system.
Append mode
This mode is the result of an a or i command.
When in append mode, the cursor appears in the text window and all
user input is taken as text to be added to the buffer.
Use dot (.) on a line by itself to get out of append
mode and back into command mode.
Note that most of
se's
control characters can be used to move the cursor around,
but vertical movement is not allowed.
In other words, left and right cursor motion works normally,
but keys such as cursor up, cursor down, page up and page down
will not work.
The control-f key functions like control-v, but the text of the current
line is duplicated instead of a blank line appearing.
Overlay mode
This mode is the result of a v command.
The cursor appears in the text window and the user can use the editor's
cursor control functions to edit the text directly.
Use the Enter key or a control-v to get out of overlay mode
and back into command mode.
Use the control-f key to abandon the changes on the current line
and then go back to command mode.
All the cursor movement characters function normally in overlay mode.
All the remaining modes are switched on and off by options or
control keys.
Absolute line-number mode
Toggled by oa.
Normally, lines are identified by upper-case letters in the left margin
of the screen.
Letter A refers to the top line of the screen, letter B
to the second, and so on.
It is often more useful to refer to lines in the buffer by their line
numbers and this is known as absolute line number mode.
Numeric line numbers appear in the left margin when this mode is
in effect.
Source-code mode
Toggled by oc.
Normally,
se
regards the text in the buffer as simply a sequence of lines and does
not imply any meaning from the text itself.
However, the editor is often used to edit text such as program source
code or document formatter input.
This text is subject to formal rules and can be understood by
programs such as compilers or document formatters.
Se
provides a mode where it applys rules to the text and understands it
in just the same way that a compiler would.
Since this mode is mainly intended for use by programmers, with program
source code, it is known as source-code mode.
In this mode,
se
recognises patterns in the text corresponding to the comment delimiter
symbols, preprocessor directives and reserved words of the language.
Comments, directives and reserved words are highlighted on the display
by colour or other similar visual effects.
Various options are used to configure
se
to recognise different source languages.
The basic requirements are the comment, directive and string delimiters
and a list of reserved words.
The of option sets up most of these and on does the
reserved words.
Read-only mode
Toggled by or.
Most operating systems provide the ability to make files read-only,
that is, to prevent their contents being altered.
Se
cannot be used to alter a read-only file, but it can be useful to look
at such a file with the editor and perhaps copy parts of it into other
files.
Even if the file is writeable it is sometimes important to prevent
accidental alteration of a file's contents.
None of the commands that alter the contents of the buffer will operate
when read-only mode is in effect.
That is, the a, c, d, i, j,
m, r, s, t, u, v,
y or zb commands will all fail with the message
File is read-only.
The w command will attempt to write the contents of the buffer
into the file but, if the file itself is read-only, it will fail.
The message read-only appears on the status line when this
mode is in effect.
If the editor is used to edit a read-only file, read-only mode is set
automatically by the e command.
The orf command can be used to toggle the state of the
read-only flag of the file as well as the buffer, but the operating
system may prevent the change.
Tab expansion and compression mode
Toggled by ox.
The message XTABS appears on the status line when this
mode is in effect.
Auto-indent mode
Switched on by oia.
When this mode is in effect, the behaviour of append mode is altered;
the cursor is not positioned at the left margin but is placed just
below the first non-blank chracter of the previous line.
You can still use the control-w key to move the cursor back to
the left margin if required.
This mode is normally used when writing program code and is
often used in conjunction with source-code mode (see above).
Case insensitive pattern matching mode
Toggled by oy.
The message case sensitive pattern matching or
case insensitive pattern matching appears on the status
line in response to the oy command, as a confirmation.
Normally,
se
will search for and match patterns in a case-sensitive way, that is
the letters in the pattern must be of the same case as the letters
in the text.
When oy is used, the letters in the pattern need not be
the same case as the letters in the text, for the match to succeed.
This mode is normally used with plain text, or with programming
languages which are case-insensitive..
Quiet mode
Toggled by oq.
Normally,
se
will make an audible signal when the cursor reaches the margin
or when certain error conditions exist.
When oq is used to turn quiet mode on, no audible signals
are produced.
The message no bells or bells appears on the status
line in response to the oq command, as a confirmation.
Global substitute mode
Toggled by og.
The message failed global substitutes continue or
failed global substitutes stop appears on the status
line in response to the og command, as a confirmation.
Encryption mode
Toggled by o#.
The message CRYPT appears on the status line when this
mode is in effect.
Encryption mode is only available on Unix systems that have the
crypt utility installed.
Insert mode
Toggled by o_ or control-a.
The message INSERT appears on the status line when this
mode is in effect.
Normally, characters typed by the user will overwrite characters
already present on a line of text.
When insert mode is in effect, characters typed in will cause
se
to move the existing text to the right to make room for the new text.
You can insert a single blank by typing control-c, but insert mode
will do this automatically on every keystroke.
Script mode
Toggled by oo.
This gives
se
the ability to be controlled by a script of commands in a file.
Typically, the script would guide the user to a particular line,
then hand over control with oo.
Once the user has done the edits on the line, he types oo
again to get the next line.
Mail notify mode
Toggled by om.
On some operating systems,
se
can inform the user when new electronic mail arrives in the user's
mailbox.
This feature is normally turned on, but can be turned of if it
is not required.
VMS privilege mode
Allows super-user status when running under VAX VMS.
This mode only works if
se
has been installed with special priviledges by the system manager.
Toggled by zp.