

        ;;;                                         ;;;
        ;;;      Copyright University of Sussex     ;;;
        ;;;                                         ;;;


1.0  INTRODUCTION
     ------------

This document provides an introduction for experienced  programmers,  to
VED,  a  powerful  screen-editor  developed for the POPLOG system at the
University of Sussex.  VED contains many novel features;
    a)  several  files  may  be  edited  and  displayed  on  the  screen
    simultaneously.
    b) cursor movement is not confined to the text areas.
    c) cursor positions can be stored and returned to later.
    d) the screen can scroll horizontally to accomodate lines  that  are
    longer than the screen width.

Although VED may be used on a variety of terminals, no reference will be
made  to particular keyboards.  Editor functions are referred to by name
and it is assumed that a "map"  of  the  users  terminal  is  available,
detailing  the  relationship  between  functions and keys.  See also the
relevant HELP file e.g.  HELP VEDKEYS for  the  VISUAL200  VDU  or  HELP
VT100 for a VT100.  (The HELP command is explained below.)


2.0  ENTERING VED
     ------------

To start editing a file called CHANGE.ME,

    $ VED CHANGE.ME

The lower portion of the screen, will be cleared and used for  the  edit
window, at the top of which will be a "command" line.  This displays the
name of the file being edited, and the number of the line on  which  the
cursor  is  positioned.   The  upper  portion  of the screen temporarily
retains previously displayed information.

WARNING:  VED sends a message asking the terminal  to  identify  itself,
and  takes  default action if there is no response within 3 seconds.  If
you type ahead, the editor will think that what you have  typed  is  the
terminal's response, and an error may result.


2.1  Initialisation Files

The values of certain editor paramaters  e.g.   the  size  of  the  edit
windows, can be set from an initialisation file.  See HELP INITIAL, HELP
VEDVARS for further details.


3.0  COMMAND EXECUTION

Functions may be executed either by pressing the relevant  keys  or  key
sequences,  or  from  command  mode.   Functions  that are executed from
function keys are referred to in UPPER CASE BOLD e.g.  DELETE-LINE.







                                                                  Page 2


3.1  Command Mode

Command mode functions are executed by typing the command on the command
line  at  the top of the edit window, terminated by RETURN.  They may be
given in upper or lower case.  The ENTER key moves  the  cursor  to  the
start  of  the  command line and clears it ready for a new command.  The
normal procedure for executing a function from command mode is

    ENTER <command> RETURN

There are two other functions associated with the operation  of  command
mode;

    CHANGE MODE
        moves the cursor to the command line without clearing it, or  if
already  on  the  command  line switches back to the text.  (This can be
used for altering a command already on the command line or  for  exiting
from command mode without executing a command).

    REDO
        repeats the command on the command line.

Commands mode functions will be referred to with a  prefix,  ENTER  e.g.
ENTER name.

Note:  Commands mode functions may be attached  to  particular  keys  to
increase speed and convenience.


3.2  More On Command Mode

The command line is a 1-line window into a file of commands and  can  be
edited  like  any  other  line  in a file.  Cursor movements made on the
command line e.g CHAR-UP, CHAR-DOWN cause the position  in  the  command
file  to  change.   A line in the command file can be executed by keying
RETURN anywhere on the line.  There is only one  command  file  for  all
files  being  edited, so on switching files the current command position
is retained.


4.0  LEAVING VED

Commands for ending the editing session;

    ENTER qq
        Quits the editor, requests confirmation if any files  have  been
        altered since they were last saved.
    ENTER xx
        Exits from VED, writing all the files that have been altered.
    ENTER rqq
        Quits VED without asking questions.

NOTE:  VED was developed for use with the POP11  system,  which  can  be
recognised by its "colon" prompt.  Accidentally typing ENTER x, or other
commands designed for use when programming in POP11, can hand control to
POP11.   To  return to VED from the POP11 system type ved.  To return to
DCL from POP11 type CTRL-Z.






                                                                  Page 3


5.0  TEXT INPUT

Printing characters are inserted into the file at the  current  location
as they are typed.


5.1  Break Mode

In "break line" mode, continuous typing  without  pressing  RETURN  will
cause  the  line  to  be  broken at word boundaries, in such a way as to
maximise the number of words on a line.  Spaces are  taken  to  indicate
word  boundaries.   In  this  mode,  the  maximum  length  of  a line is
vedlinemax characters.

If "break line" mode is off, the screen will be scrolled horizontally to
accomodate the text.  See HELP VEDNONBREAKFILES.

    ENTER break
        Switch break mode on and off.
    ENTER linemax N
        Alter the value of vedlinemax to N.   If  no  argument,  display
        current value.


5.2  Tabs(ASCII 9)

If  TABS  are  off(default),  tab  characters  will  be  converted  into
vedindentstep  spaces on input, the default value of vedindentstep is 4.
See HELP VEDNOTABS, HELP VEDINDENTSTEP.

    ENTER indent N
        Alter the value of vedindentstep to N.  If no argument,  display
        current value.
    ENTER tabs
        Switch conversion of tabs on and off.


5.3  Insert Functions(see Also Yanking)

    ENTER ic N
        inserts ASCII character N into the buffer.
    INSERT-LINE-ABOVE
    INSERT-LINE-BELOW
        Insert a new line above or below the current  line,  moving  the
        cursor to the start of that line.
    ENTER r <filename>
        Read file <filename> into buffer after current line.


6.0  WRITING TO DISC

Only files that have been altered will be written.

    ENTER w
        write all files that have been altered.
    ENTER w <filename>
        write the current file to the specified file name.
    ENTER w1
        write only the current file.




                                                                  Page 4


    ENTER wq
        write and then quit the current file.
    ENTER wqved <file>
        Like wq followed by a call of VED on a new file.
    ENTER wr <filename>
        write marked range into file <filename>.(see  below  for  marked
        range.)


6.1  Automatic Writing Of Files

The number of changes made to each file is counted.  When  this  exceeds
the  value  of vedautowrite, the file in question will be written.  This
facility may be disabled by setting vedautowrite to be false.

    ENTER autowrite N
        Sets the value of vedautowrite to be N, N = 0 sets  vedautowrite
        to false.  If no argument is given, displays the current value.


7.0  MARKED RANGES

Sections of the file can  be  "marked"  in  order  to  select  text  for
deletion/movement or to restrict the scope of certain editor funtions.

    MARK-FIRST
        Select the current line as the first of "marked" range.
    MARK-LAST
        Select the current line as the last of "marked" range.
    ENTER mbe
        Mark file from beginning to end.
    ENTER mbf
        Make beginning of file beginning of marked range.
    ENTER mef
        Make end of file end of marked range.


8.0  CURSOR MOVEMENT

The  edit-window  will  be  scrolled  vertically  when  the  cursor   is
positioned on the edge of the window and then moved past that edge.

    CHAR-UP                     Move cursor a single character,
    CHAR-DOWN                       horizontally,
    CHAR-LEFT
    CHAR-RIGHT                      vertically or
    CHAR-UP-LEFT
    CHAR-DOWN-RIGHT                 diagonally.
    CHAR-DOWN-LEFT
    CHAR-UP-RIGHT

    NEXT-LINE                   Move to beginning of next line,
                                      as indicated by vedleftmargin.

    WORD-LEFT                   Move a word to the left
    WORD-RIGHT                              or right.

    CHAR-LEFT-LOTS              Move horizontally
    CHAR-RIGHT-LOTS                    a quarter of a SCREEN.




                                                                  Page 5


    CHAR-UP-LOTS                Move vertically
    CHAR-DOWN-LOTS                     a third of a WINDOW.

    CHAR-DOWN-RIGHT-LOTS        Move diagonally -
    CHAR-DOWN-LEFT-LOTS           third of a WINDOW vertically
    CHAR-UP-RIGHT-LOTS              and
    CHAR-UP-LEFT-LOTS             quarter of a SCREEN horizontally.

    SCREEN-UP                   Move to top
    SCREEN-DOWN                     or bottom of screen.

    SCREEN-LEFT                 Move to left,
    SCREEN-RIGHT                  right or
    SCREEN-MIDDLE                   middle of screen on current line.

    TEXT-RIGHT                  Move to right,
    TEXT-LEFT                     left or
    CHAR-MIDDLE                     middle of TEXT on current line.

    TOP-OF-FILE                 Move to top or
    END-OF-FILE                     bottom of file.

    ENTER nnn                   Move to line number nnn.

    ENTER @m                    Move to beginning of marked range.


8.1  Position Stack Commands

Up to 5 cursor positions (i.e.  line and column numbers) can  be  stored
and retrieved with the use of the position stack.

    POSITION-PUSH
        Stores the current position on the stack.
    POSITION-POP
        Moves to the position at the front of the stack, which  is  then
        moved to the back of the stack.
    POSITION-SWAP
        Exchanges the current position with  that  at  the  top  of  the
        stack.


9.0  DELETING, MOVING AND COPYING TEXT.

9.1  Delete Commands

    DEL
        Delete character to left of cursor.
    DELETE-CHAR
        Delete the character underneath the cursor.
    DELETE-HEAD
        Delete everything to the left of the cursor on the current line.
    DELETE-LINE
        Delete the current line.
    DELETE-TAIL
        Delete everything to the right  of  the  cursor,  including  the
        character below the cursor.
    DELETE-WORD-LEFT
        Delete the word to the left of the cursor.




                                                                  Page 6


    DELETE-WORD-RIGHT
        Delete the word to the right of the cursor.
    ENTER d
        Delete marked range.
    ENTER da
        Delete marked range and append to DUMP(see below).

When pressed at the start of a line, DEL and DELETE-WORD-LEFT  join  the
line  to the end of the preceding line.  Unnecessary spaces are removed,
and a single space is inserted between the two merged text portions.  If
break  mode  is  set  and  the  line is too long, it will be broken at a
suitable place.  In static mode, these two functions are disabled.


9.2  Yanking

Three buffers(DUMP, LINE-DUMP and WORD-DUMP) are maintained for  storing
single  instances of deleted text.  The contents of these buffers can be
reinserted into the buffer with the yank commands.

Text deleted with ENTER d and ENTER da is stored in DUMP.

Text deleted with DELETE-LINE is stored in LINE-DUMP.

Text  deleted  with  DELETE-HEAD,  DELETE-TAIL,   DELETE-WORD-LEFT   and
DELETE-WORD-RIGHT is stored in WORD-DUMP.

    ENTER yank or ENTER y
        Insert the contents of DUMP into  the  file  after  the  current
        line.
    ENTER yankl
        Insert the contents of LINE-DUMP after the current line.
    ENTER yankw
        Insert the contents of WORD-DUMP after the current position.

All the yank commands can be used several times on the same buffers, and
for copying text between files.


9.3  Moving And Copying Text

    ENTER copy
        Copy the marked range into DUMP.
    ENTER m
        Move the marked range to after the current line.
    ENTER t
        Insert a copy of marked range after the current line.


10.0  SEARCH AND SUBSTITUTE COMMANDS

There are three search commands

    ENTER /string/
        Search forward for the first occurrence of 'string'.
    ENTER ring        Searches backward for the first occurrence of 'string'.
    ENTER "string"
        Search forward for the first occurrence of 'string'  that  is  a





                                                                  Page 7


        full  text  item.   The  full  text itemising rules of POP11 are
        used.  See HELP ITEMISE

The delimiting character at the end of the command is  optional,  unless
the  string  has trailing spaces.  If no string is given the most recent
search string is used.

NOTE:  if no matching string is found between the  cursor  position  and
the  end of the file, the forward search commands will "wrap around" and
start again at the top of the file.


10.1  Search Strings


Search strings may be  composed  of  ordinary  characters,  and  pattern
elements,  with the following properties.  (For details of how to insert
CONTROL- characters into search strings see HELP ASCII).

        @?              : matches any character
        @@              : matches a '@'
        @<delimiter>    : matches the delimiter character
        @a              : matches beginning of line
        @z              : matches end of line

Backward search does not at present allow any special pattern  items  in
the search string.


10.2  Examples

    /fred/          : search forward for next occurence of 'fred'.

    "fred@z         : search forward for next occurence of "fred"
                      at the end of a line. Will not find alfred

    // or /         : search for the next occurence of previous
                      search string.

    /fred@z@ajoe    : search for 'fred' at the end of a line followed
                      by 'joe' at the beginning of the next line.


11.0  COMBINED SEARCH AND SUBSTITUTION COMMANDS

11.1  Interactive Substitution

    ENTER s/string1/string2/
        Search forward for the next occurence of  'string1',  if  found,
"wiggle"  the  cursor  and  prompt  for  instructions.   The  acceptable
responses are

    y           : do the substitution and stop.
    RETURN      : do the substitution and search for the next
                  occurrence of string1.
    DEL         : leave this occurrence and go on to the next one
    n           : stop without doing the substitution.






                                                                  Page 8


11.2  Non-interactive Substition

    ENTER gs/string1/string2/
        Replace ALL occurrences of string1 in the FILE with string2.
    ENTER gsr/string1/string2/
        Replace ALL occurrences of string1  in  the  MARKED  RANGE  with
        string2.
    ENTER gsl/string1/string2/
        Replace ALL occurrences of string1  in  the  CURRENT  LINE  with
        string2.


11.3  Search And Replacement Strings

The  search  strings  are  the  same  as  those  given  to  the   search
commands(see above).

The replacement strings may contain the following special sequences:

        @n      : insert a newline
        @<dlm>  : insert the character used as delimiter
        @&      : insert a copy of the text matched by the search
                    string
        @@      : insert @

If an empty search string is given, the most  recent  search  string  is
used.   If  both  search  and  replacement strings are omitted, the most
recent search and replacement strings are used.


11.4  Examples

    s/fred/fried    : transform 'fred' into 'fried', interactively.

    s"fred"fried    : as above, but ignores occurrences of 'freddy'

    s"f@?@?d"fried  : transform both 'fred' and 'food' into 'fried'.

    s/@z@a@z@a//    : delete a blank line

    gs/@af/F        : change all f's at the start of a line to F.

    gs              : redo previous substitution, possibly on a
                      different file.


12.0  COMMANDS TO MANIPULATE MULTIPLE EDITS

Several files may be edited concurrently,  if  a  command  to  start  or
resume  editing  another  file  is  given,  the current file will remain
visible on half the screen.

    ENTER files
        Display the names of all files currently being edited.
    ENTER name
        Display the name of the current file.
    ENTER name <filename>
        Change the name of the current file to <filename>.
    ENTER q or VED-QUIT




                                                                  Page 9


        Quit editing the current file.  VED will return to another file,
        if there are any others in the buffer list.  If the current file
        has been changed VED asks if you want it written.  See rrq
    ENTER qved <filename>
        Quit the current file and start editing <filename>
    ENTER rrq
        Really really quit.  Don't ask about altered files.  See Q
    ENTER ved <filename>
        Start (or continue) editing the file named.
    SWITCH-WINDOW
        Switch to the most recently edited file.
    ENTER xdn
    ENTER xup
        Scroll the file in the OTHER window, down or up.
    REFRESH
        Refreshes the screen.


13.0  TEXT FORMATTING AND STATIC MODE

In static mode, typing a character overwrites the  character  under  the
cursor,  and  moves the cursor to the right.  Movement commands function
normally, delete commands overwrite with blanks and RETURN is  disabled.
The default is STATIC mode OFF.

    STATIC-MODE
        Switch static mode on and off.

This is a selection of the available commands for formatting  blocks  of
text.
    ENTER centre
        Centres current line.  Uses vedleftmargin, and vedlinemax.
    ENTER j
        Fills marked range.  Uses vedleftmargin, and vedlinemax.
    ENTER lcw N
        Transforms next N words to lower case.  N defaults to 1.
    ENTER ljmr
        Left Justify Marked range.  Uses vedleftmargin.
    ENTER margin N
        Set vedleftmargin to be N, if no argument, uses cursor position.
    ENTER right <string>
        Adds string to current line, right adjusted.  If no argument  is
        given, right adjusts text on current line.  Uses vedlinemax.
    ENTER smr
        Alphabetically sort the marked range.
    ENTER sw
        Swap the two characters to left of cursor.
    ENTER swl
        ENTER swr
        Swap the two words to the left or right  of  the  cursor.   Uses
        space as delimiter
    ENTER ucw N
        Transforms next N words to upper case.  N defaults to 1.










                                                                 Page 10


14.0  DEFINING NEW COMMANDS

    ENTER dk
        Interactively define new function for key  sequence.   See  HELP
        DK.
    ENTER dm <name>
        Interactively  define  a  new  edit  macro  "name".   See   HELP
        VEDMACROS

These commands ask if the change is to be permanent.  If so  the  user's
VEDINIT.P  is  edited  to include the change, if not a temporary file is
used.

POP11 programmers can  extend  the  editor  facilities  indefinitely  by
adding   procedures   to   their   initialistaion  files.   For  further
information see HELP INITIAL and HELP VEDMACROS.  Examples of procedures
extending  the  basic  facilities can be examined with the ENTER showlib
command e.g.  ENTER showlib ved_ic, ENTER showlib ved_centre.


15.0  FURTHER INFORMATION

    ENTER help file
        Reads in a file from the help library.
    ENTER hk
        Display information on a key, i.e.  the name of  the  associated
        function, if any.
    ENTER qhelp <file>
        Quits the current file  and  reads  in  a  file  from  the  help
        library.
    ENTER vh topic
        Allows the user to search a file  containing  information  about
        command mode functions for help on topic.



COPYRIGHT UNIVERSITY OF SUSSEX 1983
