Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SE(1)			     General Commands Manual			   SE(1)

NAME
     se - screen editor

SYNOPSIS
     se [ --acdfghiklmstuvwxyz ] [ file ... ]

DESCRIPTION
     Se  is  a	screen	oriented version of ed(1).  It accepts the same commands
     with a few differences.

     Se must be run from a CRT terminal.  It uses the termlib(3) terminal opera-
     tions library, which retrieves terminal capabilities from the  /etc/termcap
     database.	For se to function, all of the following must be true:

     1.     You  must  have  the  environment variable "TERM" set to the name of
	    your terminal type.

     2.     The /etc/termcap database must be accessible, and contain  an  entry
	    for  your  terminal; or the "TERMCAP" environment variable must con-
	    tain a description for your terminal.  (See termlib(3) for details.)

     3.     Your terminal must have the capability to do cursor motion.

     Se first clears the screen, draws in its margins, and executes the commands
     in the file ./.serc, or failing that, $HOME/.serc, if either  file  exists.
     It  then  processes  the command line, obeying the options given there, and
     begins reading your file (if you specified one).  The .serc  file	is  only
     evaluated	if  the  euid  of se matches the owner for the file and no other
     users have permission to write to the file.   The	screen	it  draws  looks
     something	like  this.   (The  parenthesized  numerals  are not part of the
     screen layout, but are there to aid in the following discussion.)

	  (1) (2)	       (3)
	  A	|
	  B	|#include <stdio.h>
	  C	|
	  D    *|   register int i;
	  E	|
	  .  -> |   for (i = 1; i <= 12; i++)
	  G	|      putc ('\n', stderr);
	  $	|
	  cmd>	|_  (4)
	  11:39   myfile ........................  (5)

     The display is divided into five parts: (1) the line number area,	(2)  the
     mark name area, (3) the text area, (4) the command line, and (5) the status
     line.   The  current line is indicated by the symbol "." in the line number
     area of the screen.  In addition, a rocket ("->") is displayed to make  the
     current  line more obvious.  The current mark name of each line is shown in
     the markname area just to the left of the vertical bar.  Other information,
     such as the number of lines read in, the name of the file, and the time  of
     day, are displayed in the status line.

     The  cursor is positioned at the beginning of the command line, showing you
     that se awaits your command.  You may now enter any of the standard ed com-
     mands and se will perform them, while making sure that the current line  is
     always displayed on the screen.

     You can set options to control the behavior of se on the command line, sim-
     ply  by using a "-", followed by the option letter, and any parameters that
     the option may take.  These options can also be set after invoking se  with
     the  options  command, "o", explained in detail in the section on commands.
     Here is a summary:

	  opt = a | c | d[dir] | f | g | h | i[a | indent] |
	       k | l[lop] | lm[col] | m | s[filetype] |
		  t[tabs] | u[char] | v[col] | w[col] |
		  x | y[key] | z | -[lnr]

     There are only a few other things that you need know  to  successfully  use
     se:

     1.     If	you make an error, se automatically displays an error message in
	    the status line.  It also leaves your command line	intact	so  that
	    you  may  change it using in-line editing commands (see the "v" com-
	    mand).  If you don't want to bother with changing the command,  just
	    hit DEL to erase the command.

     2.     The  "p" command has a different meaning than in ed.  When used with
	    line numbers, it displays as many of  the  lines  in  the  specified
	    range as possible (always including the last line).  When used with-
	    out line numbers, "p" displays  the previous page.

     3.     The  ":" command positions a specified line at the top of the screen
	    (e.g., "12:" positions the screen so that line 12 is  at  the  top).
	    If no line number is specified, ":" displays the next page.

     Keeping these few differences in mind, you will see that se can perform all
     of  the  functions of ed, while giving the advantage of a "window" into the
     edit buffer.

     Below is a summary of line number expressions, regular expressions and com-
     mands.  Where there is no difference between se and ed  no  explanation  is
     given.

   Line Number Expressions
     n	    nth line.

     .	    current line.

     $	    last line.

     ^	    previous line.

     -	    previous line.

     capital letter A
	    Ath  line  on the screen.  Se has a number of features that take ad-
	    vantage of the window display to minimize keystrokes and speed edit-
	    ing.  In the line number area of the screen, se displays  a  capital
	    letter for each line, but in "absolute line number" mode (controlled
	    by the "oa" command; see the options command) se displays the actual
	    line number of each line.

     #	    number of the first line on the screen.

     /regular expression[/]
	    next line with pattern.

     ?regular expression[?]
	    previous line with pattern.

     >name  number  of	the  next  line  having the given markname (search wraps
	    around, like //).

     <name  number of the previous line having the given markname  (search  pro-
	    ceeds in reverse, like ??).

     expression
	    any  of  the above operands may be combined with plus or minus signs
	    to produce a line number expression.  Plus signs may be  omitted  if
	    desired  (e.g.,  /parse/-5,  /lexical/+2, /lexical/2, $-5, .+6, .6).
	    Unlike ed, se does not recognize trailing "+" or  "-"  signs.   They
	    must  always  be followed by a integer.  Successive "+" or "-" signs
	    (e.g. "--") are also not allowed.  However, like vi(1), se will  al-
	    low  you  to  leave  off the trailing delimiter in forward searches,
	    backward searches, in the substitute command, the join command,  and
	    in the transliteration command.

   Regular Expression Notation
     ^	    beginning of line if first character in regular expression.

     .	    any single character other than newline.

     $	    end of line if last character in regular expression.

     [ccl] [^ccl]
	    character set.

     *	    0 or more matches of the preceding regular expression element.

     \	    ignore special meaning of the immediately following character except
	    "\(" and "\)".

     \(regular expression\)
	    Tags the text actually matched by the sub-pattern specified by regu-
	    lar  expression for use in the replacement part of a substitute com-
	    mand.

     &	    Appearing in the replacement part of a  substitute	command,  repre-
	    sents the text actually matched by the pattern part of the command.

     %	    Appearing  as the only character in the replacement part, represents
	    the replacement part used in the previous substitute command.  (This
	    allows an empty replacement pattern as well.)  If  there  are  other
	    characters	in  the  replacement part along with the "%", the "%" is
	    left alone.

     \digit
	    Appearing in the replacement part of a  substitute	command,  repre-
	    sents  the text actually matched by the tagged sub-pattern specified
	    by digit.

   File names
     Se will expand environment variables which appear anywhere in a path  name.
     Identifiers  in  a  path  name are treated as environment variables if they
     start with a dollar sign "$".  A real "$" can be used if it is escaped.  If
     the named environment variable is not found, it is deleted  from  the  path
     name.  The expanded path name will be placed in the status line.

   The .serc File
     When  se  starts up, it tries to open the file .serc in your current direc-
     tory.  If that file cannot be found, it will attempt to open the file .serc
     in your home directory.  If either file exists, se will read it,  one  line
     at  a time, and execute each line as a command.  If a line has a "#" as the
     first character on the line, or if the line is empty, the	entire	line  is
     treated  as  a  comment,  otherwise it is executed.  Here is a sample .serc
     file:

	  # turn on tabs every 8 columns, auto indent
	  ot+8
	  oia

     The .serc file is useful for setting up personalized options, without  hav-
     ing  to  type them on the command line every time, and without using a spe-
     cial shell file in your bin (for sh(1)).  The .serc file is only  evaluated
     if  the  euid  of se matches the owner for the file and no other users have
     permission to write to the file.

     Command line options are processed after commands in the .serc file, so, in
     effect, command line options can be used to over-ride the defaults in  your
     .serc file.

     NOTE:  Commands  in  the .serc file do not go through that part of se which
     processes the special control characters (see below), so do not use them in
     your .serc file.

     Commands

     (.)a[:text]  Append
	    If the command is followed immediately by  a  colon,  then	whatever
	    text follows the colon is inserted without entering "append" mode.

     (.,.)c[:text]  Change
	    If	the  command  is  followed immediately by a colon, then whatever
	    text follows the colon is inserted in place of the named lines with-
	    out entering "append" mode.

     (.,.)d  Delete

     e["!"|"x"] [filename]  Enter
	    "e!", enter now, is the same as "E" in ed.	 "ex"  enters  the  file
	    with  "XTABS" turned on, i.e. expand any tabs to blanks.  File names
	    with extensions "s", "c", "h", "f" and "r",  are  automatically  en-
	    tered with "XTABS" turned on.

     f [filename]  File

     (.,$)g/reg expr/command  Global on pattern

     none h[stuff] Help
	    This  command provides access to on-line documentation on the screen
	    editor.  "Stuff" may be used to select  which  information	is  dis-
	    played.

     (.)i[:text]  Insert
	    If	the  command  is  immediately followed by a colon, then whatever
	    text follows is inserted without entering "append" mode.   The  cur-
	    rent line pointer is left at the last line inserted.

     (^,.)j[/stuff[/]]	   Join
	    Join  is  basically  the same in se and ed except if no line numbers
	    are specified, the default is to join the  previous  line  with  the
	    current line (as opposed to the current line and the next line), and
	    se	allows	you  to  indicate  what  is to replace the newline(s) in
	    "stuff".  The default is a single blank.  If you do specify "stuff",
	    the trailing delimiter is optional. "j/" is considered the	same  as
	    "j//", i.e., the newline is deleted.

     (.,.)k[m]	 marK
	    Se	allows marks to be any single character other than a newline. If
	    "m" is not present, the lines are marked with the  default	name  of
	    blank.  (Ed allows only lower case letters to be marks.)

     none  l  Locate
	    The Locate command places the system name into the status line (e.g.
	    "gatech"  or "emory").  This is so that one can tell what machine he
	    is using from within the screen editor. This is particularly  useful
	    for  installations with many machines that can run the editor, where
	    the user can switch back and forth between them, and become confused
	    as to where he is at a given moment.

     (.,.)mline
	    Move

     (.,.)n[m]	Name
	    If "m" is present, the last line in the specified  range  is  marked
	    with  it and all other lines having that mark name are given the de-
	    fault mark name of blank.  If "m" is not present, the names  of  all
	    lines in the range are cleared.

     none  o[stuff]  Option
	    Editing options may be queried or set.  "Stuff" determines which op-
	    tions  are affected.  Options for se can be specified in three ways;
	    in the .serc file, on the command line that invokes se, or with  the
	    "o"  command.  To specify an option with the "o" command, just enter
	    "o" followed immediately by the option letter  and	its  parameters.
	    To	specify  an option on the command line, just use "-" followed by
	    the option letter and its parameters.  With this second  method,  if
	    there  are	imbedded spaces in the parameter list, the entire option
	    should be enclosed in quotes.  For example, to specify the "a"  (ab-
	    solute  line  number)  option  and	tab  stops at column 8 and every
	    fourth thereafter with the "o" command, just enter

		 oa
		 ot 8 +4

	    when se is waiting for a command.  To enter the same options on  the
	    invoking command line, you might use

		 se myfile -a "-t 8 +4"

	    You  may  also  choose to put options that you will always want into
	    your .serc file.  Commands in the .serc file should look exactly the
	    same as they would if they were typed at the se command line.   Com-
	    mand  line	options  will  always over-ride option commands given in
	    your .serc file.

	    The following summarizes the available se options:

	    a	   causes absolute line numbers to be displayed in the line num-
		   ber area of the screen. The default behavior  is  to  display
		   upper-case  letters	with the letter "A" corresponding to the
		   first line in the window.

	    c	   inverts the case of all letters you type (i.e., converts  up-
		   per-case  to  lower-case  and vice versa). This option causes
		   commands to be recognized only in upper-case  and  alphabetic
		   line  numbers  to  be displayed and recognized only in lower-
		   case.  In this mode, se displays the line number  letters  in
		   lower  case	and  expects  its command letters in upper case.
		   Unshifted letters from the terminal are  converted  to  upper
		   case and shifted letters to lower case.

	    d[dir]
		   selects the placement of the current line pointer following a
		   "d" (delete) command.  Dir must be either ">" or "<".  If ">"
		   is specified, the default behavior is selected: the line fol-
		   lowing  the	deleted  lines becomes the new current line.  If
		   "<" is specified, the line immediately preceding the  deleted
		   lines becomes the new current line.	If neither is specified,
		   the current value of dir is displayed in the status line.

	    f	   selects Fortran oriented options. This is equivalent to spec-
		   ifying  the	"ot7  +3" option, and "XTABS" is turned on (i.e.
		   tabs are expanded).

	    g	   controls the behavior of the "s" (substitute) command when it
		   is under the control of a "g" (global)  command.   Initially,
		   if  a  substitute  inside a global command fails, se will not
		   continue with the rest of the lines which might succeed.   If
		   "og"  is given, then the global substitute will continue, and
		   lines which failed will not	be  affected.	Successive  "og"
		   commands  will  toggle this behavior.  An explanatory message
		   is placed in the status line.

	    h	   controls the use of hardware line insert/delete on  terminals
		   that  have  that  capability.  By default, line insert/delete
		   will be used if available.  It is occasionally useful to turn
		   this option off when using the editor  on  a  terminal  which
		   can't  keep	up, or if the communications lines may be scram-
		   bling the control characters.  Each	successive  "oh"  merely
		   toggles  a  switch within the editor.  An explanatory message
		   is placed in the status line.

	    i[ a | indent ]
		   selects indent value for lines inserted with "a", "c" and "i"
		   commands (initially 1).  "a" selects auto-indent  which  sets
		   the indent to the value which equals the indent of the previ-
		   ous	line.  If neither "a" nor indent are specified, the cur-
		   rent indent value is displayed in the status line.

	    k	   indicates whether the current contents of  your  edit  buffer
		   have  been  saved or not by printing either a "saved" or "not
		   saved" message on your status line.

	    l[lop]
		   sets the line number display option.  Under control	of  this
		   option,  se	continuously  displays the value of one of three
		   symbolic line numbers.  lop may be ".", "#", or "$".  If  lop
		   is omitted, the line number display is disabled.

	    lm[col]
		   sets the left margin to col which must be a positive integer.
		   This  option  will  shift your entire screen to the left, en-
		   abling you to see characters at the end of the line that were
		   previously off  the	screen;  the  characters  in  columns  1
		   through  col - 1 will not be visible.  You may continue edit-
		   ing in the normal fashion.  To reset your  screen  enter  the
		   command  "olm 1".  If col is omitted, the current left margin
		   column is displayed in the status line.

	    m	   controls notification of the presence of existing mail and/or
		   the arrival of new mail in the user's mail  file.   The  mail
		   file is taken from the "MAIL" variable in the user's environ-
		   ment.  On startup, if the mail file is not empty, se will re-
		   mark,  "You	have  mail."  Then, if new mail arrives, se will
		   remark, "You have new mail," and ring  the  terminal's  bell.
		   The	"m" option simply toggles a notification switch, so that
		   the user can turn off this notification.   The  "om"  command
		   displays the current setting of the notify switch in the sta-
		   tus line.

	    s[d | data | as | s | c | h | n | nr | nroff | p | r | f]
		   sets  other options for case, tabs, etc., for data files, "d"
		   or "data", assembly files, "as" or "s", C files, "c", include
		   files, "h", nroff files,  "n"  or  "nr"  or	"nroff",  ratfor
		   files,  "r",  pascal files, "p", and fortran files, "f".  Op-
		   tions set for data and nroff files are "ow74" and "ot+4"; for
		   assembly files "ot 17+8" and "XTABS" is turned on; for C, in-
		   clude, pascal and ratfor files "ow74", "ot+4" and "XTABS"  is
		   turned  on;	for fortran files "ot 7+3" and "XTABS" is turned
		   on.	If "XTABS" is turned on then tabs are expanded.   If  no
		   argument  is  specified  the options effected by this command
		   revert to their default value.

	    t[tabs]
		   sets tab stops according to tabs.  Tabs consists of a  series
		   of  numbers	indicating  columns in which tab stops are to be
		   set.  If a number is preceded by a plus sign ("+"), it  indi-
		   cates that the number is an increment; stops are set at regu-
		   lar	intervals separated by that many columns, beginning with
		   the most recently specified absolute column	number.   If  no
		   such  number  precedes the first increment specification, the
		   stops are set relative to column 1.	By  default,  tab  stops
		   are	set in every third column starting with column 1, corre-
		   sponding to a tabs specification of "+3".  If tabs  is  omit-
		   ted, the current tab spacing is displayed in the status line.
		   Examples

			ot 1 4 7 10 13 16 19 22 25 28 31 34  ...
			ot +3
			ot 7 +3

		   Once  the tab stops are set, the control-i and control-e keys
		   can be used to move the cursor from its current position for-
		   ward or backward to the nearest stop, respectively.

	    u[chr]
		   Normally, se displays a non-printing character (e.g. NEWLINE,
		   TAB ...)  as a blank.  With this option, you can  select  the
		   character  that  se	displays in place of unprintable charac-
		   ters.  Chr may be any printable character.  If chr  is  omit-
		   ted,  se  displays  the  current replacement character on the
		   status line.  Non-printing characters  (such  as  se  control
		   characters), or any others for that matter, may be entered by
		   hitting the ESC key followed immediately by the key to gener-
		   ate the desired character.  Note, however, that the character
		   you	type  is  taken literally, exactly as it is generated by
		   your terminal, so case conversion does not apply.

	    v[col]
		   sets the default "overlay column".  This  is  the  column  at
		   which  the cursor is initially positioned by the "v" command.
		   Col must be a positive integer, or a dollar sign ($) to indi-
		   cate the end of the line.  If col  is  omitted,  the  current
		   overlay column is displayed in the status line.

	    w[col]
		   sets  the "warning threshold" to col which must be a positive
		   integer. Whenever the cursor is  positioned at or beyond this
		   column, the column number is displayed in the status line and
		   the terminal's bell is sounded.  If col is omitted, the  cur-
		   rent  warning threshold is displayed in the status line.  The
		   default warning threshold is 74, corresponding to  the  first
		   column  beyond  the	right edge of the screen on an 80 column
		   crt.

	    x	   toggles tab compression and expansion ("XTABS").  If XTABS is
		   off, "ox" turns it on for subsequent "r", and "w",  commands.
		   Be  aware  that  the "e" command checks the source option for
		   files; use the "ex" command to force tab expansion.

	    y[key]
		   allows you to edit encrypted files. "oy" followed  by  a  key
		   will  cause the "e", "r", and "w" commands to encrypt and de-
		   crypt files using crypt(1).	"oy" by itself will  toggle  the
		   current  encryption	setting.  If there is no current key, se
		   will ask you for one.  Echoing is turned off while  you  type
		   your  key in, and se asks you to type it in twice, just to be
		   sure.  If encryption is turned on, and you type a plain "oy",
		   it will be turned off.  Note that doing so causes se to  for-
		   get the value of the encryption key.  Encryption in indicated
		   by  the  message  "ENCRYPT"	in  the status line.  The key is
		   never shown on your screen.

	    z	   suspends the editor (puts it in the background)  and  returns
		   to  the user's shell.  (It has to be a shell that understands
		   Berkeley job control, or else you'll be in trouble.)  The ed-
		   itor will warn you if the edit buffer  has  not  been  saved.
		   This  is  the only way to suspend the editor; the editor uses
		   control-z for its own purposes (see the  section  on  control
		   characters,	below).  If you normally run /bin/sh without job
		   control, this command has no effect at all.

		   On UNIX systems without the Berkeley job  control  mechanism,
		   this option will be recognized, but will have no effect.  In-
		   stead,  an  explanatory  message will be placed in the status
		   line.

	    -[lnr]
		   splits the screen at the line specified by lnr which must  be
		   a  simple  line  number within the current window.  All lines
		   above lnr remain frozen on the screen, the line specified  by
		   lnr	is replaced by a row of dashes, and the space below this
		   row becomes the new window on the file. Further editing  com-
		   mands  do  not  affect the lines displayed in the top part of
		   the screen.	If lnr is omitted, the screen is restored to its
		   full size.

     (.,.)p  Print
	    Prints all the lines in the given range.  As much as possible of the
	    range is displayed, always including the last line; if no  range  is
	    given,  the previous page is displayed.  The current line pointer is
	    left at the last line printed.

     q[!]  Quit
	    "q!", exit immediately, is the same as "Q" in ed.

     (.)r[x] [filename]  Read
	    If no line number is specified, the named file is read starting  af-
	    ter current line (as opposed to ed where the file is read at the end
	    of	the  edit buffer).  "rx" causes tabs to be expanded in the lines
	    read.

     (.,.)s[/reg expr/sub[/][g][p]]	Substitute
	    If no pattern and replacement are specified after the "s",	se  will
	    behave  as	if you had typed "s//%/", i.e. for the saved search pat-
	    tern, substitute the saved replacement pattern.  To  just  delete  a
	    pattern,  you  may	type "s/stuff", and se will behave as if you had
	    typed "s/stuff//".

     (.,.)t<n>	 Copy
	    ("To" is the ed mnemonic).

     u[d]  Undo
	    "u" undoes the effects of the previous command, on the last line af-
	    fected (for instance a substitute command).  "ud"  undoes  the  last
	    delete,  i.e.  it  inserts	the  last deleted line after the current
	    line.  Se does not have a global undo capability.

     (.,.)v   oVerlay -- screen oriented editing
	    Full screen editing with se is accomplished through the use of  con-
	    trol  characters  for editing functions.  With screen oriented edit-
	    ing, control characters may be used to modify text anywhere  in  the
	    buffer.   A control-v may be used to quit overlay mode.  A control-f
	    may be used to restore the current line to its  original  state  and
	    terminate  the  command.   Since  se supports such a large number of
	    control functions, the mnemonic value of control  character  assign-
	    ments has dwindled to almost zero.	About the only thing mnemonic is
	    that most symmetric functions have been assigned to opposing keys on
	    the  keyboard  (e.g., forward and backward tab to control-i and con-
	    trol-e, forward and backward space to control-g and control-h,  skip
	    right  and	left  to  control-o  and control-w, and so on).  We feel
	    pangs of conscience about this, but can find  no  more  satisfactory
	    alternative.  If you feel the control character assignments are ter-
	    rible  and you can find a better way, you may change them by modify-
	    ing the definitions in se and recompiling.

	    Except for a few special purpose ones,  control  characters  can  be
	    used  anywhere,  even  on  the command line.  (This is why erroneous
	    commands are not erased -- you may want to edit them.)  Most of  the
	    functions  work  on  a single line, but the cursor may be positioned
	    anywhere in the buffer.  Refer to the next section	which  describes
	    each control character in detail.

     (1,$)w[+ | > | !] [filename]  Write
	    Write the portion of the buffer specified to the named file.  If "+"
	    or	">" is given, the portion of the buffer is appended to the file;
	    otherwise the portion of the buffer replaces the file.  "w!",  write
	    immediately, is the same as "W" in ed.

     (1,$)x/reg expr/command	 eXclude on pattern

     (.,.)y[/from/to[/][p]]  TranslYterate (sic)
	    The  range	of characters specified by "from" is transliterated into
	    the range of characters specified by "to". The last  line  on  which
	    something  was  transliterated is printed if the "p" option is used.
	    The last line in the range becomes the new current	line.	As  with
	    the substitute and join commands, and pattern searches, the trailing
	    delimiter  is  optional.  Se saves both the "from" and "to" parts of
	    the  transliterate	command:  "y"  is  the	same  as  "y//%/",  i.e.
	    transliterate the saved "from" range into the saved "to" range.  The
	    "%"  is special only if it is the only character in the "to" part of
	    the command.

     (.,.)zbleft[,right][char]DrawBox
	    A box is drawn on the given lines, in the given columns,  using  the
	    given  char.  This command can be used as an aid for preparing block
	    diagrams, flowcharts, or tables.

	    Line numbers are used to specify top and bottom row positions of the
	    box.  Left and right specify left and right column positions of  the
	    box.   If  second  line  number is omitted, the box degenerates to a
	    horizontal line.  If right-hand column is omitted, the box	degener-
	    ates  to a vertical line.  If char is omitted, it defaults to blank,
	    allowing erasure of a previously-drawn box.

	    For example, "1,10zb15,25*" would draw a box 10 lines  high  and  11
	    columns  across,  using asterisks.	The upper left corner of the box
	    would be on line 1, column 15, and the lower right	corner	on  line
	    10, column 25.

     (.)=  Equals what line number?

     (1,$)~mcommand  global exclude on markname
	    Similar to the "x" prefix except that "command" is performed for all
	    lines in the range that do not have the mark name "m".

     (1,$)'mcommand  global on markname
	    Similar to the "g" prefix except that "command" is performed for all
	    lines in the range that have the mark name "m".

     (.):   display next page
	    The  next  page  of  the  buffer  is  displayed and the current line
	    pointer is placed at the top of the window.

     none ![UNIX command]   escape to the shell
	    The user's choice of shell is taken  from  the  "SHELL"  environment
	    variable  (if  it exists), and is used to execute UNIX command if it
	    is present. Otherwise, an interactive shell is  created.   After  an
	    interactive  shell	exits,	the screen is immediately redrawn.  If a
	    command was run, the results are left on the screen,  and  the  user
	    must  type	RETURN	to redraw the editing window.  This is how vi(1)
	    behaves.  If the first character of the UNIX command is a `!',  then
	    the `!' is replaced with the text of the previous shell command.  An
	    unescaped  `%' in the UNIX command will be replaced with the current
	    saved file name.  If the shell command is expanded, se will echo  it
	    first,  and then execute it.  This behavior is identical to the ver-
	    sion of ed in UNIX System V.

   Control Characters
     The set of control characters defined below can be used for correcting mis-
     takes while typing regular editing commands, for correcting  commands  that
     have caused an error message to be displayed, for correcting lines typed in
     append mode, or for in-line editing using the "v" command.

     control-a
	    Toggle  insert  mode.   The status of the insertion indicator is in-
	    verted.  Insert mode, when enabled, causes the characters  you  type
	    to be inserted at the current cursor position in the line instead of
	    overwriting  the characters that were there previously.  When insert
	    mode is in effect, "INSERT" appears in the status line.

     control-b
	    Scan right and erase.  The current line is scanned from the  current
	    cursor  position to the right margin until an occurrence of the next
	    character typed is found.  When the character is found, all  charac-
	    ters  from the current cursor position up to (but not including) the
	    scanned character are deleted and the remainder of the line is moved
	    to the left to close the gap.  The cursor is left in the same column
	    which is now occupied by the scanned character.  If the line to  the
	    right of the cursor does not contain the character being sought, the
	    terminal's	bell  is  sounded.  Se remembers the last character that
	    was scanned using this or any of the other scanning  keys;	if  con-
	    trol-b  is hit twice in a row, this remembered character is used in-
	    stead of a literal control-b.

     control-c
	    Insert blank.  The characters at and to the  right	of  the  current
	    cursor position are moved to the right one column and a blank is in-
	    serted to fill the gap.

     control-d
	    Cursor  up.   The  effect  of this key depends on se's current mode.
	    When in command mode, the current line pointer is moved to the  pre-
	    vious  line  without affecting the contents of the command line.  If
	    the current line pointer is at line 1, the last line in the file be-
	    comes the new current line.  In overlay mode (viz. the "v" command),
	    the cursor is moved up one line while remaining in the same  column.
	    In append mode, this key is ignored.

     control-e
	    Tab  left.	 The cursor is moved to the nearest tab stop to the left
	    of its current position.

     control-f
	    "Funny" return.  The effect of this key depends on the editor's cur-
	    rent mode. In command mode, the  current  command  line  is  entered
	    as-is,  but  is not erased upon completion of the command; in append
	    mode, the current line is duplicated; in overlay mode (viz. the  "v"
	    command),  the  current  line  is restored to its original state and
	    command mode is reentered (except if under control of a global  pre-
	    fix).

     control-g
	    Cursor right.  The cursor is moved one column to the right.

     control-h
	    Cursor left.  The cursor is moved one column to the left.  Note that
	    this does not erase any characters; it simply moves the cursor.

     control-i
	    Tab right.	The cursor is moved to the next tab stop to the right of
	    its current position.  Again, no characters are erased.

     control-k
	    Cursor  down.   As with the control-d key, this key's effect depends
	    on the current editing mode.  In command  mode,   the  current  line
	    pointer  is  moved to the next line without changing the contents of
	    the command line. If the current line pointer is at the last line in
	    the file, line 1 becomes the new  current  line.   In  overlay  mode
	    (viz.  the "v" command), the cursor is moved down one line while re-
	    maining in the same column.  In append mode, control-k  has  no  ef-
	    fect.

     control-l
	    Scan  left.   The  cursor  is  positioned according to the character
	    typed immediately after the control-l.  In effect, the current  line
	    is	scanned,  starting  from  the current cursor position and moving
	    left, for the first occurrence of this character.  If none is  found
	    before  the  beginning of the line is reached, the scan resumes with
	    the last character in the line.  If the line does  not  contain  the
	    character  being  looked  for, the message "NOT FOUND" is printed in
	    the status line.  Se remembers the last character that  was  scanned
	    for using this key; if the control-l is hit twice in a row, this re-
	    membered  character  is searched for instead of a literal control-l.
	    Apart from this, however, the character  typed  after  control-l  is
	    taken literally, so se's case conversion feature does not apply.

     control-m
	    Kill right and terminate; identical to the NEWLINE key described be-
	    low.

     control-n
	    Scan  left	and erase.  The current line is scanned from the current
	    cursor position to the left margin until an occurrence of  the  next
	    character typed is found.  Then that character and all characters to
	    its  right	up to (but not including) the character under the cursor
	    are erased.  The remainder of the line, as well as	the  cursor  are
	    moved  to the left to close the gap.  If the line to the left of the
	    cursor does not contain the character being sought,  the  terminal's
	    bell is sounded.  If control-n is hit twice in a row, the last char-
	    acter scanned for is used instead of a literal control-n.

     control-o
	    Skip  right.   The	cursor is moved to the first position beyond the
	    current end of line.

     control-p
	    Interrupt.	If executing any command except "a", "c", "i" or "v", se
	    aborts the command and reenters command mode.  The command	line  is
	    not  erased.   This is the only way to interrupt the editor.  Se ig-
	    nores the SIGQUIT signal (see signal(2)); in fact it disables gener-
	    ating quits from the terminal.  The editor uses ASCII FS (control-\)
	    for its own purposes, and changes the terminal driver to  make  con-
	    trol-p be the interrupt character.

     control-]
	    Fix  screen.   The screen is reconstructed from se's internal repre-
	    sentation of the screen.

     control-r
	    Erase right.  The character at the current cursor position is erased
	    and all characters to its right are moved left one position.

     control-j
	    Scan right.  This key is identical to the  control-l  key  described
	    above,  except  that the scan proceeds to the right from the current
	    cursor position.

     control-t
	    Kill right.  The character at the current cursor  position	and  all
	    those to its right are erased.

     control-u
	    Erase  left.   The character to the left of the current cursor posi-
	    tion is deleted and all characters to its right  are  moved  to  the
	    left  to  fill  the  gap.  The cursor is also moved left one column,
	    leaving it over the same character.

     control-v
	    Skip right and terminate. The cursor is moved to the current end  of
	    line and the line is terminated.

     control-w
	    Skip left.	The cursor is positioned at column 1.

     control-x
	    Insert  tab.   The	character under the cursor is moved right to the
	    next tab stop; the gap is filled with blanks.   The  cursor  is  not
	    moved.

     control-y
	    Kill  left.   All  characters  to the left of the cursor are erased;
	    those at and to the right of the cursor are moved  to  the	left  to
	    fill the void.  The cursor is left in column 1.

     control-z
	    Toggle  case conversion mode.  The status of the case conversion in-
	    dicator is inverted; if case inversion was on, it is turned off, and
	    vice versa.  Case inversion, when in effect, causes all  upper  case
	    letters to be converted to lower case, and all lower case letters to
	    be	converted  to  upper  case (just like the alpha-lock key on some
	    terminals).  You can type control-z at any time to toggle  the  case
	    conversion	mode.  When case inversion is in effect, se displays the
	    word "CASE" in the status line.  Note that se continues to recognize
	    alphabetic line numbers in upper case only, in contrast to the "case
	    inversion" option (see the description of options under  the  option
	    command).

     control-_ (US)
	    Insert  newline.  A newline character is inserted before the current
	    cursor position, and the cursor is moved one position to the  right.
	    The  newline  is displayed according to the current non-printing re-
	    placement character (see the "u" option).

     control-\ (FS)
	    Tab left and erase.  Characters are erased starting with the charac-
	    ter at the nearest tab stop to the left of the cursor up to but  not
	    including the character under the cursor.  The rest of the line, in-
	    cluding the cursor, is moved to the left to close the gap.

	    Use control-p to interrupt the editor.

     control-^ (control-~, RS)
	    Tab  right and erase.  Characters are erased starting with the char-
	    acter under the cursor up to but not including the character at  the
	    nearest  tab  stop to the right of the cursor.  The rest of the line
	    is then shifted to the left to close the gap.

     NEWLINE
	    Kill right and terminate.  The characters at and to the right of the
	    current cursor position are deleted, and the line is terminated.

     DEL    Kill all.  The entire line is erased, along with any  error  message
	    that appears in the status line.

     ESC    Escape.   The  ESC	key  provides  a means for entering se's control
	    characters literally as text into the file.  In fact, any  character
	    that  can  be generated from the keyboard is taken literally when it
	    immediately follows the ESC key.  If the character	is  non-printing
	    (as are all of se's control characters), it appears on the screen as
	    the  current non-printing replacement character (normally a blank --
	    see the options command "ou").

   Windowing Systems
     On 4.3 BSD, and on the AT&T Unix/PC or 3B1, se  notices  when  its  current
     window  changes  size  or is repositioned, and adjusts the screen image ac-
     cordingly.

FILES
     $HOME/.serc
	    se initialization file.

     /usr/tmp/process id.sequence_number
	    for scratch file.

     ./se.hangup
	    where se dumps its buffer if it catches a hang-up signal.

     /usr/local/lib/se_h/*
	    help scripts for the "h" command.

DIAGNOSTICS
     Self explanatory diagnostics appear in the status line.

CAVEATS
     Se will never dump its buffer into an encrypted file when it  encounters  a
     hang-up, even if encryption was turned on at the time.

SEE ALSO
     Software  Tools,  Software Tools in Pascal, Software Tools Subsystem User's
     Guide, ed(1),  crypt(1),  ksh(1),	scriptse(1),  sh(1),  vi(1),  signal(2),
     termlib(3), termio(7), environ(5), termcap(5)

BUGS
     Can  only	be  run  from  a  script  if  the script is first passed through
     scriptse(1).

     Tabs could be handled better.  This is because se	was  originally  written
     for Prime computers.

     Does  not check whether or not it has been put into the background (this is
     to allow se to be used with the USENET news software, which does a poor job
     of signal handling for child processes).

     Occasionally flakes out the screen when doing line inserts and deletes, due
     to problems within the termlib(3) package in putting out the  right  number
     of padding characters.  Type a control-] to redraw the screen.

     The auto-indent feature does not recognize a line consisting of just blanks
     and then a "." to terminate input, when the "." is not in the same position
     as the first non-blank character of the previous line.

     There is no global undo capability.

     The help screens could use a rewrite.

AUTHORS
     Se  started  out  as  the	version  of ed that came with the book "Software
     Tools," by Kernighan and Plauger, which was written in Ratfor. On the Pr1me
     computers at the School of Information  and  Computer  Science  at  Georgia
     Tech,  Dan  Forsyth,  Perry Flinn, and Alan Akin added all the enhancements
     suggested in the exercises in the book, and some more of  their  own.  Jack
     Waugh  made  extensive  modifications to turn the line editor into a screen
     editor; further work was done by Dan Forsyth. All of this	was  in  an  im-
     proved Georgia Tech version of Ratfor.

     Later,  Dan  Forsyth, then at Medical Systems Development Corporation, con-
     verted the Ratfor version into C, for Berkeley Unix (4.1 BSD).  At  Georgia
     Tech, Arnold Robbins took the C version and added many new features and im-
     provements,  the  most  important of which was termlib support and System V
     support. The existing help screens were edited and completed at that  time,
     as well. This was finished in early 1985.

     In  early	2013,  Thomas  Cort continued maintenance of se, modernizing the
     code base and build system to  support  current  POSIX  operating	systems.
     Thomas'  primary  motivation  is to preserve this bit of computing history.
     His goals are to squash any remaining bugs and make se as portable as  pos-
     sible.  No major new features will be added. He can be reached at tcort@se-
     editor.org

				      local				   SE(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=se&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help