DOC VEDUSERGUIDE

Rosalind Barrett, 1986


Contents

Select headings to return to index

PREFACE

P.1 INTRODUCTION

VED is a display-editor developed at the University of Sussex as part of the POPLOG system, an advanced programming environment which incorporates incremental compilers for the languages POP- 11, Common Lisp and Prolog. Incremental compilation enormously speeds up program development and testing. POPLOG is used exten- sively for Artificial Intelligence (AI) research, as well as for more conventional applications.

VED provides many built-in commands and has links to most parts of the POPLOG environment. It can be used to edit text and pro- gram file, and to inspect files that form part of the system. The latter includes accessing the on-line documentation as well as the extensive program libraries which augment and extend the basic system facilities. Aside from its use as a straightforward editor, VED has the capability to pass program text direct to the language compilers, and to pass data to and from user programs.

VED provides a variety of operations for manipulating program text, either at the level of individual syntactic constructs or within a whole file, including automatic formatting and indenta- tion, substitution, cut-and-paste, etc. An individual construct such as a procedure, a range of lines in a file, or indeed a whole file, can be passed directly from an edit buffer to which- ever compiler is currently in use (POP-11, Lisp, Prolog). A pro- cedure being edited can be compiled or recompiled with a single keystroke.

POPLOG incorporates a large number of on-line documentation files, which fall into categories of HELP, TEACH, REF and DOC. HELP files are usually short (but detailed) descriptions of a particular feature of the system, such as a single procedure. TEACH files are longer, tutorial introductions to issues of AI, POPLOG or programming in general, and some contain exercises. DOC and REF files document the POPLOG system, and form a working manual to the compilers and system facilities.

P.2 THE FOCUS OF THE GUIDE

This guide is intended for those with a POPLOG system. We refer- ence online documentation files at the end of each chapter. There is no additional information in these files, though some do pro- vide exercises and others may provide information about new developments since this guide was written.

Most of the commands in VED work regardless of the subsystem (POP-11, COMMON LISP or PROLOG) from which they were invoked. Un- less otherwise indicated, everything works for all three com- pilers.

At present POPLOG runs under either the UNIX* or VMS operating systems. All features described are operating system independent except where otherwise stated.

* UNIX is a trademark of Bell Laboratories.

P.3 A TERMINAL INDEPENDENT GUIDE AND "LOGICAL NAMES"

VED can be used on many different terminals with varying key- boards. This guide is terminal independent, that is, instead of referring to keys by their number and position on any particular keyboard, they are referred to by their "logical name". All ac- tions in VED are brought about by a key or sequence of keys map- ping onto a procedure. The "logical name" of such keys, is the name derived from the corresponding procedure.

In this guide you may need to read a phrase like "the SCREENUP key ... " as "the SCREENUP key sequence ..." if your VDU lacks a SCREENUP key.

To find out where the actual keys are on your keyboard you will have to look up the mapping of the logical name to a key on your terminal map. These will be supplied separately.

For more information on key mappings see HELP VEDKEYS. This file also points to other HELP files which contain information on map- pings for various terminal types.

P.4 NOTATION USED IN THIS GUIDE

This guide uses different notation to distinguish between keys which are standard to all terminals, and non-standard keys set up for VED. Standard terminal keys are written in upper case and printed between angle brackets, for example <RETURN>, <SHIFT> and <TAB>. The logical names of keys set up for VED are written in upper case without the angle brackets, for example, the ENTER, CHARUP, SCREENDOWN and LINEDELETE keys.

Lower case words inside angle brackets are used to describe the type of text that should be inserted. For example, the following instruction tells you to type the word "ved" followed by a file name and then press the <RETURN> key:

Type:

ved <file name> <RETURN>

You do not type the angle brackets themselves, but provide a string of characters capable of naming a file on your machine. Anything not in angle brackets, for example "ved", is presented exactly as you would type it.

Names of procedures (including "VED"), categories of documenta- tion file, and names of programming languages are presented in upper case.

When we refer to "the POPLOG system" we mean either one, or all, of the POP-11, COMMON LISP and PROLOG subsystems.

P.5 FUTURE PLANS

We hope in future to make available additional manuals including an advanced VED users guide explaining how to drive VED from user programs.

P.6 ACKNOWLEDGEMENTS

Much of the information presented in this guide is based on HELP and TEACH files written by Steve Hardy, Aaron Sloman, John Gib- son, Chris Slymon and other members of the Cognitive Studies Pro- gramme at Sussex University. Thanks are also due to John Willi- ams, Mark Rubinstein, Aled Morris, Ben du Boulay, Rob Duncan, An- drew Ryan, Chris Sothcott and Denise Herzenshtein, all from Sussex University, and Colin Shearer, David Wilson, Clark Morton, Sam Valentine, Pietro Cosoli, Kim Hawksworth and Graham Thwaites, all from Systems Designers PLC. The final version was prepared by Paula Mayne.

CHAPTER 1: GETTING GOING

1.1 INTRODUCTION

This chapter provides a tutorial introduction to VED. It gives step by step instructions to do the essentials, namely look at an existing file, make a new VED file, insert and delete text, and store what you have done. It shows the effect of certain actions and gives a brief overview of the main features of VED. Most im- portantly, it shows what a VED window looks like and explains the associated terminology.

1.2 PUTTING A TEACH FILE ON THE SCREEN

This section shows one way to put a TEACH file on the screen. Once inside the file, you can practice using VED to manipulate the text. Any changes you make to a documentation file will not be stored so feel free to experiment.

To your operating system prompt type:

teach ved <RETURN>

The effect:

The TEACH file called "ved" is displayed in a "window" on the terminal screen ready for editing.

1.3 VED WINDOWS

The term "window" in VED refers solely to windows into files and has nothing to do with workstation windows, such as those on a SUN workstation.

A window is a portion of the terminal screen whose size is meas- ured in terms of "lines" (vertically) and "columns" (horizontal- ly). The size of a window can be changed during an editing ses- sion, and is limited only by the line and column boundaries of the screen . Across the top of the window is a line displaying a number and some words, in this case "EXAMINING: teach ved". This line is called the "command line". The number tells you which line in the file you are currently on. Inside the window is a small marker known as the cursor. You move around the file by moving the cursor. The line the cursor is on indicates the "current line". The file the cursor is in indicates the "current file". The location of the cursor determines where the next text modification (insertion or deletion) will be.

Normally your first VED window will take up only half the screen so that previous printout remains visible in the upper half.

1.4 MOVING AROUND THE FILE

Now that you have a VED file on the screen, you can practise mov- ing the cursor around. Move it to the bottom of the screen by pressing the SCREENDOWN key. Move it back to the top of the screen by pressing the SCREENUP key. Move the cursor one place to the right by pressing the CHARRIGHT key, one place down by press- ing the CHARDOWN key, one place to the left by pressing the CHAR- LEFT key, and one place up by pressing the CHARUP key.

As in this case, there are often more lines in a file than the window can display. If the cursor is at the bottom of the screen and you want to see more of the file, pressing the SCREENDOWN key moves the window down the file, forcing the previously displayed text to scroll up out of the window. Similarly, pressing the SCREENUP key when at the top of the screen forces the window to move up the file and the previously displayed text to scroll down.

Press the TOPFILE key to get to the top of the file, and the END- FILE key to get to the bottom of the file. Notice how the number on the command line changes as you move the cursor up and down the window.

1.5 TYPING IN CHARACTERS

With the key presses shown above you can move the cursor to any position in the window. You are now ready to insert text. Simply move the cursor to where you want to begin inserting text, and type. Begin by putting the cursor on a blank line in TEACH VED. When you come to the right hand edge of the window, VED breaks the line at a convenient place and puts the cursor at the begin- ning of the next line. Try that. Alternatively, if you want to start a new line before the current one is complete, press the <RETURN> key. This takes the cursor to the beginning of the next line. It may involve shifting the text below the current line down to make space for a new blank line. Try that.

You may want to insert more text than the window can display. The text in the window scrolls up or down in order for you to edit files which are larger than the length of the window.

If you want to insert words into an existing line of text simply position the cursor and type. Put the cursor at the beginning of a line of text in TEACH VED and type. This pushes the text to the right of the cursor along far enough to accommodate the new text. It does not overwrite the existing text. VED breaks the line when it becomes too long for the window.

1.6 DELETING CHARACTERS

If you make a mistake while typing, press the CHARDELETE key to delete the character immediately to the left of the cursor. Press the LINEDELETE key to delete the whole line that the cursor is currently on. Put the cursor to the right of one of the words in TEACH VED and press those keys to see the effect.

1.7 MERGING LINES

If you press the CHARDELETE key when the cursor is at the begin- ning of a line, the gap between the current line and the line above it is deleted. For example, insert the following two lines into TEACH VED:

Put the cursor at the beginning of the next line (this line) and press the CHARDELETE key.

The result will be: Put the cursor at the beginning of the next line (this line) and press the CHARDELETE key.

Do as it instructs. Then press the <RETURN> key to break the lines again. Practise breaking and joining lines.

1.8 CREATING ANOTHER WINDOW

VED allows you to display two windows into different files simul- taneously on the screen. Both have their own command line, though there is only ever one cursor. Follow the instructions below to make your own VED file and display it on the portion of screen not being used by TEACH VED:

    press: the ENTER key  (to put the cursor on the command
                             line. Most commands given to VED
                             during an edit session are given by
                             putting the cursor on the command
                             line in this way)
    type:  ved example     (to tell VED you wish to access a
                             file called "example".
                             The command ved <filename> is
                             similar to the command teach
                             <filename> except that it tells the
                             system you want to access a file of
                             your own rather than a TEACH file)
    press: the <RETURN> key  (to make VED do it and take
                             the cursor off the command line
                             into the new file)

The effect:

VED displays the file "example" in a new window on the screen. This window looks the same and can be treated in exactly the same way as the existing one. If you already have a file called "exam- ple" on disk, the most recent "version" will be displayed, other- wise a new file of that name will be created.

1.9 SWITCHING BETWEEN THE TWO FILES

Now the cursor is in the file called "example". If you want to go back to TEACH VED, press the SWAPFILES key. Similarly, to go from there back to "example" press the SWAPFILES key again. Practise moving the cursor between the two files.

1.10 COPYING TEXT BETWEEN FILES USING A MARKED RANGE

VED provides facilities for copying text from one file to anoth- er. For example, you may want to copy lines 3 to 9 of TEACH VED into "example". This will involve "marking" those lines in TEACH VED, and then copying the "marked range" into example. You will often find that you need to mark sections of text for different reasons. Further details of this are given in chapter 7. For now try the following:

  1. Move the cursor into TEACH VED
  2. Put the cursor on line 3

You can do this with either repeated use of the CHARUP or CHAR- DOWN keys, or you can:

press: the ENTER key (to put the cursor on the command line) type : 3 (the line number you want to go to) press: the <RETURN> key (the cursor goes to line 3 of the file)

3. Mark line 3 as the top of the range:

press: the MARKLO key

VED displays a small mark to the left of line 3 to indicate where the top of the marked range is.

4. Go to line 9 by pressing the CHARDOWN key 6 times, or by do- ing:

ENTER 9 <RETURN>

5. Mark line 9 as the end of the range:

press: the MARKHI key

VED displays the same small mark as before, and then joins the two marks up.

  1. Move the cursor back into "example" by pressing the SWAPFILES key, and position it on the line above where you want the text be inserted.
  2. press: the ENTER key (to put the cursor on the command line) type: ti (this is the command to Transcribe In from the other file) press: the <RETURN> key (to carry out the command)

The effect:

The marked range in TEACH VED is copied into "example" starting on the line below the last cursor position. Practise marking ranges and copying pieces of text between files.

1.11 REFRESHING THE WINDOW

Occasionally, the text displayed on the screen will become jum- bled. One possible cause is a broadcast message. If this happens, tell the computer to "refresh" the contents of the screen by do- ing:

press: the REFRESH key

1.12 COPYING FILES TO DISK WHILE EDITING

It is advisable every twenty minutes or so to copy your files to disk. If you do not do this and the machine crashes you will lose work. To do this:

press: the ENTER key (to put the cursor onto the command line) type: w (which stands for Write) press: the <RETURN> key (to make VED Write the files)

The effect:

Any files that you are editing will be written to disk with the exception of documentation files such as TEACH or HELP files. You can give this command from either file, and can continue editing as normal once the command has been executed.

1.13 COPYING FILES TO DISK WHEN LEAVING VED

If you want to copy your files to disk and leave VED at the same time do:

press: the ENTER key type: xx press: the <RETURN> key

This will copy your files onto the disk and terminate the run of the VED program. You should then get the operating system prompt on the screen. Try that now. Practise going back into VED from the operating system and writing files with and without leaving VED.

1.14 SUMMARY

You have seen how to make two VED files and display them simul- taneously on the screen, how to move the cursor around the win- dows and between files, how to insert and delete text, how to copy text from one file to another, and how to save your work on the disk so that you can return to it after you have left VED. These represent just some of the very simple actions in VED. Com- plete descriptions of the facilities follow in later chapters.

The concepts and terminology explained here were specifically to do with VED windows and included:

VED window screen cursor cursor movement current line current window command line

More general concepts and terminology related to VED are intro- duced in Chapter 2.

CHAPTER 2: MORE CONCEPTS AND TERMINOLOGY

2.1 INTRODUCTION

This section introduces some of the terminology associated with VED files. The keywords and phrases covered here include:

file disk quota filespace directory write to disk buffer read from disk VED bufferlist version

2.2 CONCEPTS AND TERMINOLOGY

Files are stored on a magnetic disk attached to the computer. The disk is divided into areas called directories. You have an allo- cation of area on disk (known as your "quota" or "filespace") which houses your own personal directory. VED puts any files you create into your directory (unless told to put them elsewhere). A directory as a whole is just a special kind of file. It may have subdirectories containing yet more files and directories.

You can store your files on the disk by "writing them to disk". They remain there indefinitely and thus the disk can be regarded as the computer's long term memory. You cannot edit a file while it is actually on the disk. When you invoke VED to look at and manipulate a file, it creates a temporary copy of the file. This temporary copy is known as a "buffer", and can be regarded as be- ing in the computer's short term memory.

Buffers can be created from a file which already exists on disk, in which case the file is "read in from disk", or created from scratch when no file of the specified name exists. In the latter case the buffer starts off empty. Changes you make to the buffer will only be made permanent by writing it to disk.

The term "VED bufferlist" refers to the collection of file struc- tures VED currently has temporary copies of. For more information on the bufferlist see chapter 6 sections 1 - 3.

The words "file" and "buffer" may be used synonymously in this guide even though, strictly, they are distinct.

You can store more than the most recently written copy of a file on disk. We refer to these "back copies" as "versions".

2.3 HELPFUL ONLINE DOCUMENTATION

TEACH TEACH - How to use VED to read TEACH files TEACH VEDPOP - Switching between VED and POP-11 or PROLOG TEACH FILES - Information about files and directories and purging

CHAPTER 3: ENTERING VED

3.1 INTRODUCTION

This chapter shows both how to make your own files and how to ex- amine the system's documentation files.

3.2 ENTERING VED

3.2.1 Creating a new file

Type:

ved <new file name> <RETURN>

3.2.2 Accessing an existing file from your directory

Type:

ved <existing file name> <RETURN>

3.2.3 Accessing the system online documentation using VED

POPLOG provides five major categories of online documentation - the TEACH, HELP, REF, DOC and LIB files. You use VED to examine them. To invoke them, type the name of the category of documenta- tion followed by the name of the file, for example:

teach <file name> <RETURN> help <file name> <RETURN> ref <file name> <RETURN> doc <file name> <RETURN> showlib <file name> <RETURN>

If you are already running VED, precede the above command with a press of the ENTER key.

If the file name you give does not exist in the system, VED refers you to an index file in the appropriate category of docu- mentation. If no file name is given, but a file of that category is currently in the bufferlist, VED accesses that file. Otherwise it accesses or refers you to the appropriate index file.

Note for VMS users: since a DCL help facility already exists, it is necessary to use the keyword "hlp" for POPLOG "help".

3.3 INVOKING VED IN DIFFERENT CONTEXTS

VED may be invoked from either the monitor (DCL on VMS; SH or CSH on UNIX) or from within the POPLOG system.

3.3.1 From the monitor

Give any of the commands in Section 2 to the monitor prompt.

3.3.2 From the POPLOG system

To invoke VED from the POP-11 or PROLOG subsystem, simply follow the prompt with any of the commands in Section 2.

To invoke VED from COMMON LISP, precede the commands in section 2 with the "at" symbol, @.

To invoke VED from within VED, give any of the above commands from the command line (See Chapter 4 Section 3.2 for instructions on how to give a command from the command line).

3.4 FILE NAMES

The characters that can be used to name a file are restricted both by the monitor and by the POPLOG system. These restrictions need not hinder you yet. Simply follow the guidelines below to get going.

A valid file name usually contains alphanumeric characters and underscores - additional characters may allowed - consult the manual. However, some operating systems may limit the number of characters allowed. For example, Unix System V (and derivatives, like hp-ux) impose a limit of 14 characters. BSD Unix 4.2/4.3 impose a limit of 255 characters. VAX/VMS 4.x impose a limit of 39 alphanumeric characters for the file name and a limit of 39 alphanumeric characters for the file type. If you are creating a program file, these characters should include a file type exten- sion so that VED knows which compiler to invoke. For POP-11 pro- gram files, the required extension is .p , for PROLOG program files, .pl , and for COMMON LISP, .lsp Thus, for example:

myfile1.p myfile2.pl myfile3.lsp

are valid file names for POP-11, PROLOG, and COMMON LISP program files respectively.

For more information on file name restrictions consult your operating system manual and the appendix in the VED Advanced User Guide.

3.5 HELPFUL ONLINE DOCUMENTATION

TEACH VED - Using VED to alter or create files TEACH MORE - VED exercises TEACH FILES - Information about files and directories TEACH MOREVED - Follows on from TEACH VED HELP VED - short annotated list of available online files on VED

CHAPTER 4: POSITIONING THE CURSOR AND INSERTING TEXT

4.1 INTRODUCTION

Chapter 1 showed that positioning the cursor and inserting text is very simple. That was a brief overview to get you going. In this chapter we give more details about inserting characters with VED, and describe all the keys and VED procedures available for moving to any position in a file.

4.2 CHARACTER INSERTION MODES

Ved can be set in either of two modes when inserting and deleting characters - "insert" mode or "static" mode. VED is initialised in "insert" mode because it is most commonly used. The behaviour of the character insertion procedures described in Chapter 1 ap- plies only when VED is in insert mode.

You set static mode by pressing the SETSTATIC key, which is a toggle. When you press this key, VED tells you whether you are turning static mode on or off.

Sections 2.1 and 2.2 describe how characters are inserted when VED is in each mode. Chapter 5 explains how text deletion is af- fected by mode.

4.2.1 Insert Mode

If you are editing a file in insert mode and you put the cursor in the middle of a line and start typing, everything to the right moves over to make space for the new characters inserted. For ex- ample, if the cursor in on the "e" in "fred" and you type an "i", the result is "fried" with the cursor still on the "e" but both shifted one place to the right. A line break mechanism exists which, by default, causes the line to break automatically when it gets too long for the window. This mechanism works only in text files (indicated by the file type extension). In program files the window scrolls to the left if necessary, to display the end of the line.

Switching the line break mechanism on and off

To switch break mode on or off in a text file do:

press: the ENTER key type: break press: the <RETURN> key

VED tells you whether break mode is on or off.

4.2.2 Static (or overwrite) Mode

When typing in a file with static mode on, new characters replace existing characters and the cursor moves right. So if the cursor is on the "d" in "dog" and you type "h", the result is "hog" with the cursor on the "o".

Static mode disables the <RETURN> key and the line break mechan- ism, and also affects the behaviour of some of the delete pro- cedures (see Chapter 5).

Cursor movement commands function as normal in static mode.

4.3 MOVING THE CURSOR

There are two ways to move the cursor around a file - pressing the keys set up for VED on your terminal (all of which map onto VED procedures), and calling VED procedures by name from the com- mand line.

4.3.1 Moving the cursor around with key presses

The first four key presses presented here are the basic ones that every terminal must be set up with. The others are made up of combinations of these four, and some of them may not be set up on your terminal.

Moving one character up

The CHARUP key moves the cursor up one character. If you press it when the cursor is at the top of the window the text scrolls down to display the line the cursor has moved to. Think of the cursor as pushing the window up the file in that case. If the cursor is at the top of the file and the top of the window when you press the CHARUP key, VED sounds the terminal bell.

Moving one character down

CHARDOWN moves the cursor down one character. Pressing it while the cursor is at the bottom of the window forces the window down the file and the text to scroll upwards. If the last line of the file is at the top of the window and the cursor is at the bottom, pressing the CHARDOWN key causes VED to sound the terminal bell.

N.B The last two keys may be used while the cursor is on the com- mand line to examine previous VED commands.

Moving one character to the left

CHARLEFT moves the cursor left one character. If already in the leftmost column the cursor moves to right of the line above. VED complains if there is no line above.

Moving one character to the right

CHARRIGHT moves the cursor right one character. The screen scrolls to the left if the cursor is in the rightmost column of the window.

Moves to the boundaries of the window or text

SCREENUP - move to the top of the window, or up a window if al- ready at the top. This key is very useful for reading large files - it gives you a windowful at a time.

SCREENDOWN - move to the bottom of the window, or down a window if already at the bottom.

SCREENLEFT - move to the leftmost column of the window. Scroll text to the right if column is not already in the window.

SCREENRIGHT - move to the rightmost column of the window.

TEXTLEFT - move to the beginning of the text on the current line.

TEXTRIGHT - move to the end of the text on the current line, scrolling text to the left if necessary.

Moves to the boundaries of a file

TOPFILE - move to the first line of the file, as opposed to the first line of the window.

ENDFILE - move to the line below the last line of text in the file, that is, the end of the file.

NEXTLINE - move to the beginning of the next line in the file, scrolling text up if the cursor is at the bottom of the window.

Moves of one word

WORDLEFT - move left a word or, if there is no word to the left of the cursor, move to the right of the preceding line of text.

WORDRIGHT - move right a word or to the beginning of next line of text if there is no word.

The last two keys define word boundaries in a manner that corresponds to text item boundaries in a programming language.

Diagonal moves of one character

CHARUPLEFT - move cursor up a character and left a character

CHARUPRIGHT - move cursor up a character and right a character

CHARDOWNLEFT - move cursor down a character and left a character

CHARDOWNRIGHT - move cursor down a character and right a charac- ter

Large jumps across the window

CHARRIGHTLOTS - move cursor about a quarter of the current window width to the right.

CHARLEFTLOTS - move cursor about a quarter of the current window width to the left.

SCREENMIDDLE - move cursor to the column in the middle of the screen on the current line.

The CHARMIDDLE key - move cursor to character in middle of current line of text.

CHARDOWNLOTS - move cursor down about a third of the current win- dow length.

CHARUPLOTS - move cursor up about a third of the current window length.

CHARDOWNRIGHTLOTS - move cursor down about a third of the window, and about a quarter of the window to the right.

CHARDOWNLEFTLOTS - move cursor down about a third of the window, and about a quarter of the window to the left.

CHARUPRIGHTLOTS - move cursor up about a third of the window and about a quarter of the window to the right.

CHARUPLEFTLOTS - move cursor up about a third of the window, and about a quarter of the window to the left.

4.3.2 VED procedures for positioning the cursor

The following procedures move the cursor. To make them work you must call them from the command line. To call a VED command, first move the cursor to the command line by pressing the ENTER key. Then type the name of the command, and then press the <RE- TURN> key. VED obeys the command.

To move the cursor off the command line without giving a command, press the STATUSSWITCH key. This key can also be used to put the cursor on the command line without clearing the previous command.

Moving the cursor to the beginning of the file

To move the cursor to the beginning of the file:

press: the ENTER key type: @a press: the <RETURN> key

From now on we will abbreviate such a sequence of events to:

ENTER @a <RETURN>

Moving to the beginning of a marked range

ENTER @m <RETURN>

Moving to the end of a file

ENTER @z <RETURN>

Moving to a specified line in a file

ENTER <line number> <RETURN>

4.3.3 Storing and returning to cursor positions

VED allows you to store a cursor position and return to it later. This is useful if you are, for example, reading or moving blocks of text around large files. To store a cursor position, press the PUSHKEY key. To return to that place, press the POPKEY. The po- sition is no longer stored.

You can store up to five positions concurrently in this way, pressing the POPKEY will restore you to the most recently stored position.

The EXCHANGEPOSITION key swaps the current position with the last stored position, moving the cursor to the latter. This is very useful if you are moving back and forth between two parts of a file.

4.4 HELPFUL ONLINE DOCUMENTATION

TEACH TEACH - How to use VED to read teach files TEACH VED - Using VED to alter or create files TEACH MORE - VED exercises

CHAPTER 5: DELETING AND RETRIEVING TEXT

5.1 INTRODUCTION

Everyone makes mistakes when typing. Chapter 1 showed how to delete single characters and whole lines of text using key presses. This chapter goes into more detail. It shows how dele- tion is affected by mode, and how it can be achieved with VED commands as well as key presses. It ends with a section showing how to retrieve deleted text.

5.2 DELETING CHARACTERS AND TEXT

VED has facilities for deleting single characters, and for delet- ing larger portions of text with a few key-strokes. These are di- vided into procedures invoked by special keys, and procedures in- voked by name from the command line.

"Head" refers to text to the left of the cursor on the same line, and "tail" refers to the rest of the line, including the charac- ter under the cursor.

5.2.1 Deleting single characters with key presses

The CHARDELETE key

Insert mode on:

This deletes the character to the left of the cursor and shifts the tail of the line left to fill the gap. For example, if the cursor is on the "e" in "fried" and you press CHARDELETE, the result is "fred". If the cursor is in the leftmost column, the current line is joined to the preceding line. If break mode is on, and the resulting line is too long, it will be broken at a suitable place.

Static mode on:

CHARDELETE deletes the character to the left of the cursor but does not shift the rest of the line to fill the gap. If the cur- sor is in the leftmost column, VED simply complains.

The DOTDELETE key

Insert mode on:

This deletes the character under the cursor and shifts the tail of the line left to fill the gap.

Static mode on:

DOTDELETE deletes the character under the cursor.

5.2.2 Deleting lines and parts of lines with key presses

The CLEARHEAD key

Insert mode on:

CLEARHEAD deletes the head of the current line and shifts the tail of the line to the leftmost side.

Static mode on:

CLEARHEAD deletes the head of the current line, and moves the cursor to the far left, leaving the tail where it was.

The CLEARTAIL key

This deletes the tail of the current line.

The LINEDELETE key

This deletes the current line and moves the text below the cursor up one line to fill the gap.

5.2.3 Deleting words with key presses

The WORDLEFTDELETE key

To delete a word to the left of the cursor put the cursor immedi- ately to the right of the word and press the WORDLEFTDELETE key. It deletes the word and any spaces to the left. If insert mode is on, the tail of the line is shifted left to fill the gap.

The WORDRIGHTDELETE key

To delete a word to the right of the cursor, put the cursor on the first character of the word and press the WORDRIGHTDELETE key. This deletes both the word and any spaces to the right.

5.2.4 ENTER commands for deleting text

Deleting everything from the current file

ENTER clear <RETURN>

Deleting a whole procedure (only relevant in a program file)

To delete a procedure put the cursor somewhere inside it and do:

ENTER dcp <RETURN>

If you do not put the cursor inside a procedure, VED deletes the procedure above the cursor, if one exists. Otherwise it com- plains.

Deleting from the current line to the end of a file

ENTER deof <RETURN>

Deleting a marked range

ENTER d <RETURN>

The text below the marked range moves up to fill the gap.

5.3 RETRIEVING TEXT

If you delete information by mistake you can save having to re- type it by giving one of the following commands:

5.3.1 Retrieving deleted lines and parts of lines

To retrieve the last line of text deleted with the LINEDELETE key, do:

ENTER yankl <RETURN>

VED inserts the text above the current cursor line. You can do this several times to make multiple copies of the line.

To retrieve the text last deleted with the CLEARHEAD, CLEARTAIL, WORDLEFTDELETE or WORDRIGHTDELETE key, do:

ENTER yankw <RETURN>

The text is inserted to the right of the cursor. Like YANKL, this may be repeated.

5.3.2 Retrieving deleted ranges of text

To retrieve the text last deleted by any of the commands in sec- tion 2.4 do:

ENTER yank <RETURN>

or:

ENTER y <RETURN>

5.4 HELPFUL ONLINE DOCUMENTATION

TEACH TEACH - How to use VED to read teach files TEACH VED - Using VED to alter or create files TEACH MORE - VED exercises TEACH YANK - Using ENTER y <RETURN> in VED HELP VEDCOMMS - list of ENTER commands HELP VEDKEYS - pointers to use of VED on different keyboards HELP VED - list of HELP files relevant to VED

CHAPTER 6: MULTIPLE EDITS

6.1 INTRODUCTION

It is possible to have more than two files in the bufferlist, but unless you have a very large screen with lots of lines, it is not usually possible to display more than two files simultaneously. This chapter shows how to display one or two files on the screen, how to access the files in the bufferlist if there are more than two, and how to switch between files. A section on the command line is included because this is a one line window into a special VED buffer containing the commands you have given. The chapter ends by describing the procedures available for copying and mov- ing text between files.

6.1.1 The need for multiple edits

Multiple edit facilities are useful because it is quicker to ac- cess files that are already in the VED bufferlist, than to access them from the disk. Also, it is often convenient to display two files simultaneously. You might, for example, want to compare them, or have some online documentation in one half of the screen for reference.

6.2 ACCESSING MORE THAN ONE FILE

If you are editing a file and want to access another file, give any of the commands listed in Chapter 3, Section 2 from the com- mand line.

VED diplays the file asked for in a second window on the screen. If the file is already in the bufferlist, VED simply re-displays it, otherwise it either fetches the file from disk, or, if there is no file of that name in your directory, creates a new file.

6.2.1 Changing and finding out the size of the windows

By default, the size of a window is half the size of the screen. You can change the length of a window by doing:

ENTER ws <number> <RETURN>

from either window. The lower window becomes <number> lines long. The upper window becomes the screen length minus the length of the lower window.

To find out the size of the lower window, simply do:

ENTER ws <RETURN>

VED prints the size on the command line. You can work out the size of the upper window from this.

6.2.2 Changing between half and whole screens

When you have two files on the screen you can press the SETWINDOW key to make the current window take up the whole screen. The oth- er file remains in the VED bufferlist. The key is a toggle, so that pressing it again reduces the window to its original size.

If this key is used to reduce a window from full screen when the cursor is in the lower half of the screen, VED leaves the upper half visible on the screen until another VED command fills the space. This is sometimes useful when you need to see one part of a file while working on another part.

6.2.3 Moving between two files

To move the cursor between two windows press the SWAPFILES key. The cursor jumps from one window to the last position it was at in the other.

If you have only one window, but there are other files in the bufferlist, pressing the SWAPFILES key displays the last file ac- cessed in a new window. Whether it uses the full screen or not depends on the default window size (see Section 2.2).

6.2.4 Moving between multiple files

The two easiest ways to make files in the bufferlist visible in a window are to use the FILESELECT key or the VED command RB. Al- ternatively, you can give the commands described in Chapter 3.

The FILESELECT key

If you have three or more files in the bufferlist and cannot display more than two simultaneously, use the FILESELECT key to access the file you want. When you press the key, VED prints out a numbered list of the files in the VED bufferlist on the command line. Simply press the number corresponding to the file you want.

If the names of all the files in the bufferlist will not fit on the command line, VED creates a special window to present the op- tions. Press the appropriate letter or number to get the file on the screen.

Typing anything but a number or letter corresponding to a file leaves you in the file you were editing when you pressed the FILESELECT key.

Rotating through the files

If you want to cycle through the files in the bufferlist using only the current window, do:

ENTER rb <RETURN>

RB stands for "rotate buffer". If there are only two files in the bufferlist RB works in the same way as the SWAPFILES key.

6.3 INTERROGATING THE BUFFER

VED provides some procedures to help you find out things about files in the bufferlist.

6.3.1 Finding out the state of files in the bufferlist

To find out which files you are currently editing, that is, which ones are in the bufferlist, do:

ENTER files <RETURN>

VED tells you the names and directories of the files, how many lines they have, how many changes you have made since you last wrote them to disk, whether or not you need to write them to disk, and whether or not they need compiling.

6.3.2 Finding out the name of the current file

To find out the name of the current file do:

ENTER name <RETURN>

VED prints on the command line the full path-name of the file. As soon as you press a key it removes the information.

6.4 THE COMMAND LINE

Chapter 4 Section 3.2 showed how to move the cursor on and off the command line and how to give VED commands. Included here is a section on the command line because it is actually a one line window into a buffer known as the command file. The command file consists of the VED commands you have given, and can be edited like any other file.

The command file only holds thirty lines. When these have been used VED overwrites the lines, starting from the first one. When you press the ENTER key to put the cursor on the command line it goes to a new blank line at the end of the file. The STATUSSWITCH key moves the cursor on and off the command line without changing position in the command file.

Though each window has its own command line, there is only one command file for all files being edited. Thus if you give a VED command and then go to another file, that same VED command ap- pears on the command line of the new file. The current command position is retained.

6.4.1 Redoing commands

The most recent command remains visible on the command line after it has been executed. To repeat it, press the REDOCOMMAND key. This saves having to retype the command.

6.4.2 Looking up previous commands

To look back at the commands you have given, move the cursor to the command line then press the CHARUP or CHARDOWN key to scroll backwards or forwards through the command file. Press the REDOCOMMAND or the <RETURN> key to repeat any of the commands (after editing if necessary). The cursor can be positioned any- where on the command line when you do this.

6.4.3 Multiple commands

ENTER do <commands> <RETURN>

allows you to give several commands at once, so that they can easily be re-done. For example, to cycle through the files in the bufferlist going to the beginning of each one, do:

ENTER do ; rb ; @a <RETURN>

The first non-space character after "do" (in this example ";") is taken as the command delimiter and is used to separate the com- mands. Pressing the REDOCOMMAND key will then cause all the com- mands given to be repeated.

6.5 MOVING AND COPYING TEXT BETWEEN FILES

VED provides several commands for copying or moving a marked range of text between the current file and another file. In each case an optional file name may be specified to move the text to or from. If not given it is assumed to be the last file accessed (before the current file).

6.5.1 Copying text from one file to another

Transcribe a marked range of text into the current file

ENTER ti <optional file name> <RETURN>

The file name is the name of the file that the marked range is in. A copy of the text is inserted into the current file, start- ing on the line below the last cursor position.

Transcribe a marked range out of the current file

ENTER to <optional file name> <RETURN>

The file name is the name of the file that the marked range is to be copied to. If you specify a non-existent file name, VED creates a file of that name. A copy of the text is inserted in the target file, starting on the line below the last cursor posi- tion, and will not be "marked".

6.5.2 Moving text from one file to another

Moving text is similar to copying text, except that once moved, the text is deleted from its original place.

Move a marked range of text into the current file

ENTER mi <optional file name> <RETURN>

Move a marked range out of the current file

ENTER mo <optional file name> <RETURN>

6.6 HELPFUL ONLINE DOCUMENTATION

TEACH VED - Using VED to alter or create files
TEACH WINDOW -  Switching window sizes
TEACH SWITCHWINDOW - How to switch between two VED
                     windows
TEACH BUFFERS - How to switch between more than two VED
                files
HELP MARK - Marking and manipulating ranges
HELP COPY - Copying and retrieving  text

CHAPTER 7: MARKING A RANGE

7.1 INTRODUCTION

You will often want to do something to only a portion of a file or a procedure, for example move it somewhere else, or change all the words from upper to lower case. After some general informa- tion about marked ranges, this chapter shows the facilities available for marking different sections of files. A section on how to mark a range of commands in the command file is included.

VED marks a range in a file by drawing a line down the side of the designated section. You can only have one marked range per file, but each file in the bufferlist can have its own.

7.2 HOW TO MARK A RANGE

There are two ways to mark a range - with procedures invoked by special keys, and by invoking procedures by name from the command line.

7.2.1 Using keys to mark a range

To mark a range using key presses, put the cursor on the line you want as the top of the range and press the MARKLO key. VED makes a mark on the left of the window next to that line. Next place the cursor on the line you want as the end of the range and press the MARKHI key. VED makes a similar mark by this line, then joins the two marks together. You can mark any number of lines as a range, from just one to the entire length of the file.

If either key is pressed when there is already a marked range, the range will be extended, or shortened, as necessary, to make the current line the new beginning (MARKLO) or end (MARKHI) of the range. The same comment applies to commands that invoke these procedures (described in section 2.2 below).

Notice that MARKLO marks the top of the range. "lo" and "hi" refer to the line numbers, not the position on the screen.

7.2.2 Using VED procedures to mark a range

VED provides command line procedures which mark varying amounts of files.

Marking the whole of the current file - "Mark Beginning to End"

ENTER mbe <RETURN>

Marking the current procedure - "Mark Current Procedure"

ENTER mcp <RETURN>

Marking the beginning of the file - "Mark Beginning of File"

ENTER mbf <RETURN>

This invokes MARKLO on line 1 of the file.

Marking the end of a file - "Mark End of File"

ENTER mef <RETURN>

This invokes MARKHI on the last line of the file.

Marking beginning of current procedure - "Mark Beginning of Procedure"

ENTER mbp <RETURN>

This invokes MARKLO on the first line of the procedure.

Marking the end of the current procedure - "Mark End of Procedure"

ENTER mep <RETURN>

This invokes MARKHI on the last line of the procedure.

7.3 MARKING A RANGE IN THE COMMAND FILE

VED allows you to mark a range of commands in the command file. Use the CHARUP and CHARDOWN keys while on the command line to scroll up and down the file and mark the beginning and end of the range with the MARKLO and MARKHI keys as described above. To exe- cute the sequence of marked commands press the LMR key (LMR stands for Load Marked Range). This is a very useful facility for multiple substitutions (see Chapter 8 "Searching and Substitution in VED").

7.4 HELPFUL ONLINE DOCUMENTATION

HELP VED - list of HELP files relevant to VED HELP MARK - Marking and manipulating ranges

CHAPTER 8: SEARCHING AND SUBSTITUTION IN VED

8.1 INTRODUCTION

VED provides facilities for searching for specified items in files and substituting them with something else. For example, if you have consistently misspelt a word, VED can change all oc- currences. If necessary, you can make it check each one first. You may also search for items without doing any substitutions. This is useful for taking you to headings, or to find out if you have used a particular word in a file.

8.2 SEARCH COMMANDS

VED allows you to search both forwards and backwards for items in the current file. You can search for either a single item, or a group of items.

The item or items being searched for are referred to as the "search string". If VED finds an item matching the search string it moves the cursor to it, otherwise it prints "(NOT FOUND)" on the command line without moving the cursor. When searching for- ward, if VED does not find the item by searching to the end of the file it starts looking from the top of the file. This "wrap- around" feature is useful but can be confusing.

When searching forwards for a single item you can look for exact matches only, or for embedded matches as well. When searching backwards you cannot specify that only exact matches be found.

An "exact" match means that an item will only match the search string if it shares the same boundaries. An embedded match means that an item will match the search string regardless of leading or trailing characters surrounding the matching item. For exam- ple, if VED is searching for the string "hat on", with an embed- ded match it would find "that one", but with an exact match it would only find "hat on".

With the exception of caseless searching described in section 2.7, all the searching procedures described here are case specif- ic. That is, VED will not find "David" if you are searching for "david" with a lower case "d".

8.2.1 Searching forwards

Exact matches only

ENTER "<search string> <RETURN>

Embedded matches

To allow the search to include the string embedded in a larger string do:

ENTER /<search string> <RETURN>

For example if you do:

ENTER /fine <RETURN>

VED finds "fine" embedded in such words as "define" and "refined" as well as occurrences of "fine" itself.

You can "close" the search string with a "/". For example:

ENTER /fine / <RETURN>

finds "fine" followed by two spaces, but not by one. It will find "define" followed by two spaces but it will not find "finesse". Closing the search string is the only way to make this search so specific.

8.2.2 Guiding the forwards search

You can restrict the forwards search to specific places in the file, for example the beginning and ends of lines.

Searching for items at the beginning of a line

To search for an item starting a line, precede the search string with the characters @a. For example do:

ENTER "@afred <RETURN>

or:

ENTER /@afred <RETURN>

to find the word "fred" at the beginning of a line.

Searching for items at the end of a line

End the search string with the characters @z to find an item end- ing a line. For example:

ENTER /define@z <RETURN>

looks for the word "define" at the end of a line.

The command:

ENTER /fred@z@ajoe <RETURN>

searches for "fred" at the end of a line followed by "joe" at the beginning of the next line.

8.2.3 Using wild card characters in the search string

VED allows you to insert wild card characters in the search string. The characters @? in the search string will match any single character in the text.For example:

ENTER /d@?e <RETURN>

finds an item containing "d" and "e" separated by any other char- acter. Similarly:

ENTER "d@?@?@?ne <RETURN>

finds "define", "dryane" or "debone" etc.

8.2.4 Searching for special characters

Below are the special commands for looking for characters match- ing the search symbols used in the search string.

Searching for @

To find a string containing @, put @@ into the search string. For example:

ENTER /@@ <RETURN>

matches a @.

ENTER /@@@@ <RETURN>

matches @@.

Searching for delimiter characters

A delimiter character refers to the symbol you use on the command line to direct the search (e.g. / or " ). If you are searching for one of these characters put the character @ before it in the search string. For example do:

ENTER /@/ <RETURN>

to find the next occurrence of a possibly embedded /

and do:

ENTER "@" <RETURN>

To find a non-embedded occurrence of ".

Searching for control characters

To search for control characters in your file do:

ENTER /\^<name of control character> <RETURN>

For example, to search for the form-feed character, which is CTRL-L do:

ENTER /\^L <RETURN>

8.2.5 Searching backwards

To search for an item occurring before the current cursor loca- tion do:

ENTER \<search string> <RETURN>

If a matching item is not found before the current location, the backward search mechanism does not "wrap around" and continue from the end of the file.

At present you cannot modify the backwards search to find only non-embedded strings, or use pattern elements like @a, @z and @?.

8.2.6 Default search strings

If you give an empty search string, for example:

ENTER / <RETURN> ENTER \ <RETURN> ENTER " <RETURN>

VED uses the most recent string used in a search command.

8.2.7 Caseless searching

VED provides two procedures for caseless searching. Matches succeed whatever the case of the letters in the search string and the text.

ENTER ss <string> <RETURN>

finds embedded occurrences of the string. For example:

ENTER ss ExAmPle <RETURN>

finds "examples", "Example", " EXAMPLE", "eXaMpLe" etc.

ENTER ww <string> <RETURN>

searches for non-embedded occurrences of the string. For example:

ENTER ww ExAm <RETURN>

finds "exam", "Exam", "EXAM", "eXaM", but not "Example".

8.3 COMBINED SEARCH AND SUBSTITUTION COMMANDS

VED allows you to change the item it finds. To do this you must use the combined search and substitution commands. We refer to the item being sought as the "search string" and the item to re- place it as the "replacement" or "substitute" string. The com- ments given in section 2 on searching all apply to the searching part of these commands.

VED provides both interactive and non-interactive, or global, search and substitution commands. The interactive version asks each time a match is found in the file whether you want to sub- stitute the matching item with the replacement string. The non- interactive commands automatically change all matching items in a specified portion of the file.

8.3.1 Interactive substitution

To replace one item with another do:

ENTER s/<search string>/<replacement string> <RETURN>

to include embedded occurrences of the search string,

or:

ENTER s"<search string>"<replacement string> <RETURN>

to find exact matches only.

For example, to change "deffine" to "define" do:

ENTER s/deffine/define <RETURN>

VED searches for the next occurrence of "deffine" and wiggles the cursor to catch your eye. It then gives you four options:

press "y" to do the substitution and stop.
  press <RETURN> to do the substitution and go on to the next
          occurrence.
  press <DEL> to leave this occurrence and then go on to the next
          one.
press "n" to stop without doing the substitution.

As explained above, the delimiter character can be included in the search or replacement string if preceded by @. If @ itself is to be part of either string it must be represented as @@. N.B. If the substitute string is to include one or more trailing spaces, it should be terminated with a final occurrence of the delimiter character. For example:

ENTER s/fred/joe / <RETURN>

will replace "fred" with "joe" followed by two spaces.

Default search and substitute strings

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.

8.3.2 Special symbols in the replacement strings

The replacement strings may contain the following special sym- bols. @n to insert a newline @& to insert a copy of the text matched by the search string @<delimiter> to insert the character used as delimiter @@ to insert @

Examples: To insert a line break before the next occurrence of "fool" do:

ENTER s/fool/@nfool <RETURN>

To replace "rabbit" with "rabbits", type the command:

ENTER s/rabbit/@&s <RETURN>

"@&" can be very useful when the search string includes "@?" so you cannot tell in advance what is to be substituted. To go to the end of the current line and insert the delimiter character / do:

ENTER s/@z/@/ <RETURN>

8.3.3 Global, or non-interactive substitution

The procedures described below should be used if you are sure that you want to change all the items matching the search string in the chosen section of the file. As before you can use either the / or the " delimiters.

Changing all items matching the search string in the whole file

There are two procedures which replace all items matching the search string in the whole file:

ENTER gs/<search string>/<replacement string> <RETURN>

and:

ENTER sgs/<search string>/<replacement string> <RETURN>

GS stands for "Global Substitute". Using the command line it con- tinually updates the number of substitutions made.

SGS stands for "Silent Global Substitute". It works much like the global substitute command, but does not record the number of sus- titution made. It simply reports them at the end. This speeds up the process where the number is very large.

Global substitution in a marked range

To replace all items in a marked range of a file do:

ENTER gsr/<search string>/<replacement string> <RETURN>

GSR stands for "Global Substitute in Range".

Global substitution in the current line

ENTER gsl/<search string>/<replacement string> <RETURN>

Global substitution in the current procedure

ENTER gsp/<search string>/<replacement string> <RETURN>

8.3.4 Default search and substitute strings

If you do not provide a search string, for example if you do:

ENTER gs//<replacement string> <RETURN>

VED uses the previous search string.

If you provide neither a search string nor a replacement string VED uses the last search and replacement strings.

8.4 HELPFUL ONLINE DOCUMENTATION

TEACH VED - Using VED to alter or create files TEACH MORE - VED exercises HELP SUBSTITUTE - summary of search and substitution commands HELP VEDSEARCH - searching and substitution in VED HELP ASCII - character codes HELP STRINGS - creating and using strings HELP VEDCOMMS - alpahabetic list of VED commands HELP VED - list of HELP files relevant to VED

CHAPTER 9: LOADING FILES

9.1 INTRODUCTION

This chapter shows you how to load or run programs from within VED. Loading means the same thing as compiling in VED and we use the terms synonymously. Compilation is simply the translation of what you type into executable machine code. This includes compil- ing procedure definitions, and compiling and executing commands to run procedures. Program output (including error messages) may be inserted into a VED file or simply printed on the terminal. It is possible to do all your program development and testing in VED, including using a VED buffer for program input and output. This makes it easy to redo old commands (possibly with slight variations) and to keep a record of the interaction in a VED file to insert into a report later.

VED provides commands for compiling different portions of files. They also differ in where they take you after they have been run. Some leave you in VED while others take you to the compiler top level (i.e. POP-11, COMMON LISP or PROLOG). Some also write the file to disk.

Section 9.4 shows how to direct output to a convenient place and how to deal with it.

9.2 PROCEDURES FOR LOADING PROGRAMS

This section describes VED procedures available for compiling a whole file, a section of a file, a single procedure, a file on disk, and a library program. It begins with the ones which leave you in VED and continues with the procedures which load files and then leave VED.

9.2.1 Staying in VED

Loading all program files in the bufferlist

ENTER l <RETURN>

loads all program files in the VED bufferlist and then returns to the current file.

Loading the current file

ENTER l1 <RETURN>

compiles the current file and leaves you there.

Loading the current procedure

ENTER lcp <RETURN>

LCP stands for Load Current Procedure. Place the cursor at any point in the procedure to give the command.

Loading a marked range

ENTER lmr <RETURN>

LMR stands for Load Marked Range. VED loads only the marked range of the current file.

Loading a library file

ENTER lib <library file> <RETURN>

loads the specified library file.

Loading a file from the disk or the bufferlist

ENTER load <file name> <RETURN>

Loads a file from either the VED bufferlist or the disk. If you do not provide a <file name>, VED loads the current file.

9.2.2 Going back to the compiler "top level"

Compiling all program files in the bufferlist

ENTER c <RETURN>

compiles all program files in the bufferlist and takes you back to the compiler top level.

Compiling the current file

ENTER c1 <RETURN>

compiles the current file and takes you back to the compiler top level. It compiles the file even if it is unchanged.

9.3 COMPILING AND WRITING FILES

This section shows the procedures for writing and compiling pro- gram files simultaneously.

9.3.1 All files in VED bufferlist

ENTER x <RETURN>

writes all changed and writeable files, compiles all program files in the VED bufferlist and then takes you back to the com- piler top level.

9.3.2 The current file

ENTER x1 <RETURN>

writes and compiles the current file and returns to the compiler top level. It compiles the file even if it is unchanged.

9.4 HOW TO DIRECT OUTPUT ARISING FROM COMPILATION

VED puts any printing it produces while trying to compile code in the current "output" file. The default file for the POP-11 and PROLOG compilers is called "output". The default file for COMMON LISP users is called "output.lsp" in the current working directo- ry.

You can change where VED is to print output by giving one of the following commands:

9.4.1 Directing output to a named file

ENTER output <file name> <RETURN>

redirects output to <file name>. Any new output is appended to the end of the buffer.

9.4.2 Directing output to the current file

ENTER output . <RETURN>

sends output to the current file. It is inserted after the current line.

9.4.3 Directing output to the screen

ENTER output ^ <RETURN>

sends output to the screen, as opposed to a file.

9.4.4 Finding out where your output is going to

ENTER output <RETURN>

makes VED display the name of the output file on the command line, or indicates that it will always go to the current file.

9.5 MISHAP AND WARNING MESSAGES

If VED cannot compile a file because it contains mistakes it prints out a MISHAP message in the current output file. If that file is the current file, VED marks the message from the begin- ning to the end so that you can do:

ENTER d <RETURN>

to delete it.

VED inserts warning messages, for example messages about unde- clared variables, into the file in comment form (i.e. after three semicolons) and does not mark them.

9.6 HELPFUL ONLINE DOCUMENTATION

HELP VED - list of HELP files relevant to VED HELP MARK - Marking and manipulating ranges HELP LMR - loading marked ranges and redirecting output

CHAPTER 10: WRITING AND QUITTING FILES

10.1 INTRODUCTION

This chapter shows how to write one or more files to disk. You usually want to do this when leaving VED and POPLOG, but you can also write files during an editing session. This safeguards against losing work. The section "Writing and Quitting Files" shows how to write one or all of the files in the VED bufferlist and leave VED. The section "Writing Files" shows you how to write one or all the files in the bufferlist and remain inside the current file. It also shows how to use VED's automatic facility for writing files.

Just as you can write files without quitting them, so you can quit files without writing them. This is useful if a VED file has been used for some temporary purpose such as testing a program or doing a calculation, or if you are not satisfied with the current changes and want to start again from the last written version. As with writing and quitting files, you have the choice of:

remaining in VED if there are more files in the bufferlist leav- ing VED but not POPLOG in order to interact with top-level loop of the current POPLOG language compiler leaving POPLOG complete- ly, in which case the system from which POPLOG was invoked will resume control, for instance DCL in VMS, or a shell in UNIX.

The section "Quitting Files" shows the commands available.

Only files that have been altered will be written. Some files cannot be written at all. None of the HELP or TEACH files, for example, are "writeable". If you look at another user's files it is advisable to invoke them using "pved" (for Protected VED) as opposed to "ved". This will prevent inadvertent writing. (For in- formation on how to protect your own files from being written, or even read by others, consult your local system expert or operat- ing system manual).

10.2 WRITING AND QUITTING FILES

Writing a file means that it is copied onto the disk. Quitting a file means that it is removed from the VED bufferlist.

10.2.1 Write and quit the current file

Do:

ENTER wq <RETURN>

to write and quit the current file. VED reverts to another file if there is one, otherwise it returns control to the compiler from which VED was invoked.

10.2.2 Write and quit the current file, then edit a new specified file

ENTER wqved <file name> <RETURN>

10.2.3 Write and quit all VED files and exit from VED and POPLOG

ENTER xx <RETURN>

writes all changed and writeable files in the VED bufferlist and then goes to the operating system or whatever invoked POPLOG. This is synonymous with ENTER bye <RETURN>.

10.3 WRITING FILES

Writing a file means copying it onto the disk and also keeping it in the bufferlist. VED provides facilities for writing either just the current buffer or all the buffers in the bufferlist.

10.3.1 Writing the current file

ENTER w1 <RETURN>

writes just the current file. If it is not writeable VED com- plains.

ENTER w <file name> <RETURN>

writes a copy of the current file onto disk with the name given. It does not alter the name of the file ( see section 7 below on how to do this).

10.3.2 Writing all the files in the bufferlist

ENTER w <RETURN>

writes all the changed and writeable files in the bufferlist.

10.3.3 Writing a file and going to another

ENTER wved <file name> <RETURN>

writes the current file and then invokes the specified file.

10.3.4 Writing a portion of a file into a new disk file

ENTER wr <file name> <RETURN>

creates a new disk file with the given name and copies a marked range from the current file into it. If a file with the new name previously existed (and is not protected) it may be over-written.

10.4 AUTOMATIC WRITING OF FILES

It is advisable to write files regularly during an editing ses- sion. If the computer crashes, for example, work will be saved only up to the last written version. VED provides an automatic safety mechanism - after a certain number of changes it writes the current file to disk. Each character added or deleted counts as one change. Certain other more complex operations done by a single command or key also count as one change, such as LINEDELETE, WORDELETE, or ENTER d <RETURN>. Changes in different files are counted separately. By default, VED automatically writes files after 1500 changes. To change this default value do:

ENTER autowrite <integer> <RETURN>

To switch off the autowrite mechanism in a session do:

ENTER autowrite 0 <RETURN>

To find out how many changes the autowrite facility is set at do:

ENTER autowrite <RETURN>

VED prints out the value on the command line.

To find out how many changes VED has counted since the current file was last written do:

ENTER :vedchanged <RETURN>

VED prints the number on the command line.

10.5 QUITTING FILES

Quitting a file means that you do not first save it on disk. VED provides facilities for quitting individual and multiple files, either leaving you in VED, or taking you to POPLOG or the operat- ing system.

10.5.1 Commands to quit a single file

Quitting the current file

ENTER q <RETURN>

quits the current file. If the file has been changed, and it is not a POPLOG documentation file, VED asks if you want to write it first. Respond with "y" (yes), "n" (no), or "c" (to continue editing that file). If you respond with "y" or "n" editing re- verts to another file if there is one in the bufferlist, other- wise it leaves VED but not POPLOG.

Quit current file, then edit a new specified file

ENTER qved <file name> <RETURN>

quits the current file and goes to the named file (if you provide a file name), or the next most recently edited file in the buf- ferlist (if you do not provide a file name).

Quit current file, then exit VED

ENTER qpop <RETURN>

quits the current file, an enters the current compiler's top lev- el loop.

Quit current file, then edit a specified HELP file

ENTER qhelp <file> <RETURN>

Quit current file, then edit a specified TEACH file

ENTER qteach <file> <RETURN>

Quit current file, then edit a specified library file

ENTER qshowlib <file> <RETURN>

Quitting the current file without writing

ENTER rrq <RETURN>

quits the current file without giving you the option to write it first. It is easy to lose work using this command. RRQ stands for Really Really Quit.

10.5.2 Commands to quit all files and leave POPLOG

Quitting all files and the editor with a chance to write them

ENTER qq <RETURN>

quits all files and the editor. If you have changed any files VED asks if you want to first write them. Respond with "y" (yes), "n" (no), or "c" (to continue editing the current file).

Quitting all files and the editor with no chance to write them

ENTER rqq <RETURN>

quits all the files and takes you to the operating system without offering the chance to write any changed files.

10.6 TEMPORARILY LEAVING VED WITHOUT ALTERING THE VED BUFFER

To go to the current POPLOG top-level subsystem without writing or quitting any files, do:

ENTER pop <RETURN>

This takes you straight to POP-11, PROLOG or COMMON LISP without altering the VED buffer in any way. To get back to the place in the file you gave the command from, type:

ved

to the subsystem prompt. (@ved to the COMMON LISP subsystem prompt.)

10.7 CHANGING THE NAME OF A FILE

To change the name of a file currently being edited, do:

ENTER name <file name> <RETURN>

This affects VED's copy of the file only, and so any copies of the current file residing on disk will NOT be affected. The name change becomes apparent when VED writes the file to disk, since the new name is used, not the old. Notice that this will leave any copies of the file with the old name untouched. It is by us- ing NAME that users can make private copies of POPLOG documenta- tion or library files.

10.8 HELPFUL ONLINE DOCUMENTATION

TEACH VED - Using VED to alter or create files HELP VED - list of HELP files relevant to VED

CHAPTER 11: FORMATTING TEXT

11.1 INTRODUCTION

This chapter examines commands for formatting text during and after insertion.

11.2 FORMATTING TEXT WHILE INSERTING IT

11.2.1 Setting and finding the values of the left and right mar- gins

To set the left margin do:

ENTER lcol <optional number> <RETURN>

<optional number> becomes the leftmost column. The default left- most column is 1. If you do not provide a number, VED uses the column which the cursor is in.

Similarly set the right margin with:

ENTER rcol <optional number> <RETURN>

The default column is 78.

To find out what the leftmost and rightmost columns are set at do:

ENTER lcol ? <RETURN>

and:

ENTER rcol ? <RETURN>

respectively. VED prints the information on the command line.

11.2.2 Controlling the effect of the tab character

By default VED inserts 4 space characters when you press the <TAB> key. Doing:

ENTER indent <number> <RETURN>

inserts up to <number> blank spaces until the current column number divided by <number> leaves the remainder 1. So if <number> is 8, and the current column is 11, pressing <TAB> inserts 5 blank spaces making the column 17 which, when divided by 8, leaves the remainder 1.

11.3 FORMATTING WRITTEN TEXT

VED provides various commands for tidying up the left and/or right hand margins of text files, and the left hand margins of program files. This kind of tidying up is known as "justifica- tion".

Commands vary according to the amount of justification required, the file type (program or text), and what portion of text is to be justified.

In text files "full justification" produces text with both the first and last characters on each line aligned with the respec- tive margin. "Justifying" a text file, as opposed to "fully jus- tifying" it places as many words as possible on each line, but does not insert extra spaces in between words to align the last text character with the right margin. In program files VED in- dents certain lines by inserting extra spaces or tabs at the left hand side, in order to make the "nesting" of the program clearer. This is sometimes referred to as "pretty-printing" a program. Un- like some pretty printers for program files, VED does not break or merge lines in a program.

The text to be justified can be either a marked range, the current paragraph, or the current procedure. The current para- graph is defined as that body of text containing the cursor that is bounded by empty lines or lines beginning with a full stop.

If the current file is a program file VED assumes that the text should be formatted as a program unless otherwise informed.

11.3.1 Justifying the current procedure - ENTER jcp <RETURN>

VED moves lines left or right, as required, to create indenta- tions that make the procedure easy to read.

11.3.2 Justifying both text and program files

In a marked range - ENTER j <RETURN>

In non-program files this justifies a marked range. In program files it works the same as JCP but on the marked range of the file as opposed to the current procedure.

Justifying the current paragraph or procedure - ENTER jp <RETURN>

In text files JP works like J, except it operates on the current paragraph as opposed to a marked range. In program files JP does the same as JCP.

11.3.3 Justifying text only

Justifying text in program file - ENTER fill <RETURN>

Justifies block of text (like ENTER j) irrespective of the current file type. i.e It treats a marked range as text even if the file is a program file.

Justifying text paragraph in program file - ENTER fp <RETURN>

Justifies current paragraph (like ENTER jp) irrespective of the current file type.

11.3.4 Fully justifying text

Fully justifying text in a marked range - ENTER jj <RETURN>

VED aligns the first and last words on each line (except the last lines of paragraphs) with the leftmost and rightmost columns respectively by inserting spaces where appropriate.

Fully justifying the current paragraph - ENTER jjp <RETURN>

Works like ENTER JJ <RETURN>, except it operates on the current paragraph as opposed to a marked range.

11.3.5 Removing excess spaces from a marked range
                                    - ENTER gobble <RETURN>

This leaves a single space between words. Leading spaces at the beginning of lines are left so that paragraph indentations remain. The command is intended as an antidote to ENTER JJ <RE- TURN>. However, it may not return text to exactly the same form as it was before the ENTER JJ <RETURN> command. If, for example, you are in the habit of inserting two spaces after a full stop you will lose one of them.

11.3.6 Aligning text

VED can align individual lines in a marked range with either one of the margins or the centre of the window. There are also com- mands to align single lines of text.

Aligning text to the centre of the window

ENTER ac <RETURN>
                   AC stands for Align Centre.
                  VED puts the individual lines
             in a marked range centrally between the
      leftmost and rightmost window columns, as shown here.
ENTER centre <optional item> <RETURN>
VED puts the item given as argument in the centre of the  current
line.   If  you  do not provide an argument VED moves the current
line of text
       (for example this one) to the centre of the window.

Aligning text with the left or right margins

ENTER al <RETURN>

aligns each line in a marked range with the left margin. Similar- ly:

ENTER ar <RETURN>

aligns each line in a marked range with the right margin.

Aligning an item with the rightmost column

ENTER right <optional item> <RETURN>
VED puts <item> to the right of the current line. If you  do  not
   provide one VED aligns the current line (for example this one)
                         with the rightmost column of the window.

11.3.7 Moving blocks of text

To the left - ENTER bl <optional number> <RETURN>

VED moves a block of text in a marked range <optional number> columns to the left. The command allows you to move text as far as the leftmost edge of the screen even if this exceeds the left- most window column setting. The command does not work at all if at least one of the lines in the marked range is at the screen's left margin. If a number is not given, VED moves the block to the left by a single column.

To the right - ENTER br <optional number> <RETURN>

Like ENTER bl <RETURN> only there is no limit to the number of spaces VED moves the block of text to the right.

To the centre - ENTER bc <RETURN>

BC stands for Block Centre. VED moves a marked block of text so that the unit as a whole, as opposed to the individual lines in the range (see ENTER ac <RETURN>) is centred between the leftmost and rightmost columns.

11.3.8 Changing the case of words

VED provides procedures for changing the case of individual words, all words in a line, and all words in a marked range. They leave non-alphabetic characters unchanged. Below are the pro- cedures for changing to lower case - the "l" in all the names stand for "lower". Substitute this with "u" to change to "upper" case.

Words - ENTER lcw <number> <RETURN>

Transforms the next <number> of words to lower case. <number> de- faults to 1.

Lines - ENTER lcl <number> <RETURN>

Transforms the next <number> of lines to lower case. The cursor moves to the next line.

Marked range - ENTER lcr <RETURN>

Transforms a marked range to lower case.

11.3.9 Moving a marked range of text - ENTER m <RETURN>

Moves a marked range of text to after the current line in the same file. See Chapter 6 section 5 for information on how to move and copy text between files.

11.3.10 Copying a marked range of text - ENTER t <RETURN>

Transcribes a marked range to after the current line in the same file.

11.4 HELPFUL ONLINE DOCUMENTATION

TEACH VED - Using VED to alter or create files
TEACH MORE - VED exercises
HELP PAGE - LIB PAGE and LIB RNO commands for formatted
            printing
HELP FORMAT - VED commands to format text files
HELP VED - list of HELP  files  relevant  to  VED

APPENDIX 1: TAILORING VED

Introduction

There are many ways in which the editor can be adapted to suit individual needs. Taking full advantage of its flexibility re- quires a knowledge of POP-11 programming. Techniques for this will be explained in detail and illustrated in the VED Advanced Users Guide and the VED Programmer's Guide. This appendix ex- plains a subset of the facilities for users who are not POP-11 programmers.

Most of these facilities require the creation of a file called 'vedinit.p' in your login directory, or the directory you have assigned to the logical name '$poplib'. This file is compiled whenever VED starts up. In it you can give a command to compile a library file to tailor VED for your terminal, you can set global variables of various kinds to alter VED's defaults, and you can define a procedure to be run whenever VED creates a new file, and a procedure to be run whenever VED makes a file the current file i.e. puts it on the screen and puts the cursor in its window.

Examples will be given below which can be copied and modified as necessary by someone who is not a POP-11 programmer, but under- stands programming concepts.

Compiling a library file for your VDU

Suppose you use a Televideo terminal model 925. You will then want to compile LIB tvi925. You can do this by inserting into your vedinit.p file the line

lib tvi925;

This compiles the file and prints out a message saying so. The following alternative will just compile the file without telling you:

loadlib('tvi925');

If you use a different terminal, then instead of 'tvi925' in ei- ther command, you will need a different name. See HELP VEDKEYS for options available or ask your local system expert.

Setting Global Variables in 'vedinit.p'

There are many global variables that control the default behaviour of VED. Most have a number as value, but some have a string or list. You can alter any of these by including POP-11 assignment statements in your vedinit.p file.

For example, VED starts by assuming that you are using a VDU whose screen holds 24 lines, and 80 columns, and that you want each new file when it comes onto the screen to have a window of 12 lines, i.e. taking up half the screen. You can change the de- fault window size to be full screen thus:

24 -> vedstartwindow;

This makes it impossible to have two files visible at once, but is preferred by some users.

If your VDU has more than 24 lines, say 60, like the Ann Arbour, you could do:

60 -> vedscreenlength; 30 -> vedstartwindow;

VED automatically writes the current file after a certain number of changes, controlled by a variable whose default value is 1500. You can make it write after every 500 changes by:

500 -> vedautowrite;

or turn off autowriting altogether by:

false -> vedautowrite;

The number of characters by which the TAB key indents is set to 4 by default. If you wish it to be 8, the more conventional size, do

8 -> vedindentstep;

On UNIX systems VED normally keeps one backup version of each file it writes, using the suffix '-' for backup versions. I.e. it keeps up to two versions. You can increase the number of backup versions to 4 by doing:

5 -> vedversions;

(5 = 4 + 1, the 1 being the current version). The backup versions will then have suffixes '-', '--', '---', '----'.

There are some VED variables that have lists of directories as their values. These are used by commands such as HELP and TEACH and LIB, to indicate where to search for documentation or library files. You can also tell the VED command itself about a list of your own directories in which you keep files, so that it will search in those files if it does not find the file you want in your current directory. This is often convenient if you keep dif- ferent sorts of files in different directories, but may wish to access them easily. This is also useful if two or more users wish to share the files in a particular directory.

Tell VED where to look for files by assigning a list of directory names to vedsearchlist. The list is created by using square brackets, and each directory name is enclosed in single string quotes, e.g. on unix

['mylib' 'letters' 'work'] -> vedsearchlist;

or, on VMS:

[ '[.mylib]' '[.letters]' '[.work]' ] -> vedsearchlist;

If you just give file names like that, VED will treat them as names of sub-directories of the current directory. If they are subdirectories of your login directory, and you want to access them no matter which directory you happen to be working in, then you have to give the full path name for each directory. On UNIX you can use '$HOME' as your login directory, hence:

          ['$HOME/mylib'   '$HOME/letters'    '$HOME/work']    ->
vedsearchlist;

On VMS you can assign logical names to directories and use them, on full path names, in your search lists. E.g. SYS$LOGIN is a logical name for your login directory. You can therefore do some- thing like:

['SYS$LOGIN' '[FRED.LIB]' 'MYLIB'] -> vedsearchlist;

where 'MYLIB' has been defined as a logical name, for example in your LOGIN.COM file.

You can use the file extension to control whether VED starts the file in 'break' mode or not. There is a default list of file ex- tensions for which VED assumes break mode is not wanted, namely:

['.p' '.com' '.lsp' '.pl'] -> vednonbreakfiles;

Suppose you often write FORTRAN programs with file names ending in '.for' and PASCAL programs with file-extension '.pas' and you wish line-break mode to be off for these. You can add these to the list as follows:

          ['.pas' '.for'  ^^vednonbreakfiles  ]  ->  vednonbreak-
files;

There are several more VED variables described in HELP VEDVARS. Most of these are best left alone unless you are an experienced POP-11 programmer.

It is possible to define a procedure called 'vedveddefaults' that will be run whenever you start up a new ved file. You can use it to test the sort of file and do one of the above assignments ac- cordingly. For example, you may wish vedindentstep to be 4 for all files except those with suffix '.for', and you may wish vedstatic to be set true for files with suffix '.fig'. You can then put the following POP-11 procedure definition in your vedinit.p file:

    define vedveddefaults;
        if isendstring('.for', vedcurrent) then
            8 -> vedindentstep;
        else
            4 -> vedindentstep;
        endif;
        if isendstring('.fig', vedcurrent) then
            true -> vedstatic;
        else
            false -> vedstatic;
        endif;
    enddefine;

Altering VED key sequences

The built in procedure vedsetkey can be used to tell the editor that a sequence of characters, which may either be transmitted by the user, or by a function key, is to be given a new meaning. The simplest use of this is to define new abbreviations. This is done by giving vedsetkey two strings, the first being an abbreviation for the second.

Defining abbreviations

For example, if to indicate that 'df' is to be an abbreviation for 'define' and 'edf' for 'enddefine' insert the following two commands into your vedinit.p file:

vedsetkey('df', 'define '); vedsetkey('edf', 'enddefine;');

This may produce slightly counter-intuitive behaviour, since VED will no longer 'echo' the initial characters when you type them in as it has to wait to find out what you will type next. This means that it may be best to make all abbreviations start with a character not used for other purposes, e.g.

vedsetkey('@d', 'define '); vedsetkey('@e', 'enddefine;');

VED will not accept an abbreviation where the first string is a substring of the second,

vedsetkey('def', 'define ');

as this would cause the system to loop indefinitely, replacing 'define' with 'defineine' then 'defineineine' etc.

Assigning a procedure to a key sequence

vedsetkey can also be used to map a character sequence onto a VED procedure. The VED Advanced User's Guide will show how to map key sequences onto procedures defined by the user. Users can also map key sequences onto built-in procedures.

This is done by making the first argument to vedsetkey a string indicating the character sequence (to be typed by the user, or transmitted by a function key) and the second argument the pro- cedure to be run. Usually, the character sequence will start with the <ESC> character or a control character, so it is necessary to show how to represent these special characters in strings in POP-11. They are indicated by the two 'lead in' characters ''. So, CTRL-A is represented by 'A', CTRL-B by 'B', etc. <ESC> by '[' and the <DEL> key by '?'.

The following lines could be used in your vedinit.p file to tell VED that <ESC> followed by "l" should move the cursor one word left, <ESC> followed by "r" should move it one word right, <ESC> followed by "L" should delete a word to the left of the cursor, and <ESC> followed by "R" should delete a word to the right of the cursor:

vedsetkey('[l', vedwordleft); vedsetkey('[r', vedwordright); vedsetkey('[L', vedwordleftdelete); vedsetkey('[R', vedwordrightdelete);

In order to make full use of this facility for mapping character sequences onto procedures users will need to know which built in procedures are available for use as the second argument to vedsetkey.

The files HELP VEDPROCS and HELP VEDCOMMS list VED procedures. Many of these can be mapped on to editing key sequences. The fol- lowing are the most likely to be useful:

vedchangecase()
    Change chase of current character and move right one.
    Default CTRL-N
vedchardownleft()
    Move down diagonally to the left. For other directions
    replace 'down' with 'up' and 'left' with 'right'.
    For bigger moves append 'lots', e.g.:
vedcharupleftlots()
    Move up diagonally to left, several times
vedcharuplots()
    Move up several lines
vedcharuprightlots()
    Move up diagonally to right, several times
vedclearhead()
    Delete current line to left of cursor
vedcleartail()
    Delete current line to right of cursor
vedendfile()
    Go to end of file
vedenter()
    Clear command line, put cursor on command line
vedlineabove()
    Insert line above current line.
vedlinebelow()
    Insert line below current line.
vedlinedelete()
    Delete current line
vedloadline()
    Loads current line without altering the marked range
vedmarkfind()
    Move to beginning of marked range
vedmarkhi()
    Make current line end of marked range
vedmarklo()
    Make current line start of marked range
vedmidwindow()
    Scroll up or down till current line is middle of window
vednextline()
    Move to beginning of next line. (like LF button)
vedpositionpush()
    Push current position onto vedpositionstack.
vedpositionpop()
    Restore location at top of vedpositionstack. If there are not
    more than 5 stacked positions, save this one at end of stack.
vedredocommand
    Re-do the command on the command line
vedrefresh()
    Refresh screen. Usually mapped to <ESC> V or a function
    key
vedscreendown()
    Move cursor to bottom of window or down a window if
    already at bottom
vedscreenleft()
    Move cursor to left of screen
vedscreenright()
    Move cursor to right of window
vedscreenup()
    Move to top of window, or up a window if already at top
vedtextleft()
    Move to beginning of text on current line
vedtextright()
    Move to right of text on current line
vedsetstatic()
    Switch static mode on or off
vedsetwindow()
    Make current window fill whole screen, or return to half
    screen. Usually mapped to <ESC> w.
vedswapfiles()
    Switch cursor to other file.  Usually mapped to <ESC> x
vedstatusswitch()
    Switch cursor from status line to file, or vice versa.
vedtopfile()
    Move to top of file
vedwordleft()
    Move cursor one word to left
vedwordleftdelete()
    Delete word to left
vedwordright()
    Move cursor one word right
vedwordrightdelete()
    Delete word to right
vedwritefiles()
    Write all writeable and changed files
ved_j
    'Justify' marked range. Fills if it is a text file, does
    indentation if a program file.
ved_jcp
    Justify current procedure, using ved_tidy
ved_jj
    Fully 'Justify' marked range. Aligns left and right margins.
ved_jjp
    Fully justify current paragraph.
ved_jp
    Justify current paragraph if text file, procedure otherwise.
ved_l1
    Load current file
ved_lcp
    Load current procedure.
ved_lcw
    Transforms next word to lower case.
ved_lcl
    Lower case line
ved_ucw
    Upper Case Word.
ved_ucl
    Upper Case Line
ved_lmr
    Load (compile) marked range from edit buffer.
ved_m
    Move marked range to after current line.
ved_mi
    Move marked range from 'other' file into current one
ved_mo
    Move marked range from this file to 'other' one
ved_t
    Transcribe marked range to after current line.
ved_ti
    Transcribe (copy) marked range from 'other' file to current
    one.
ved_to
    Transcribe (copy) marked range from current file to 'other'
    one.
ved_mp
    Match parenthesis. Moves cursor right to next '(', or ')'.
    Then immediately moves left or right to matching ')' or '('.
ved_rb
    Rotate Buffers in VED. Same as <ESC> X if there are only
    two files being looked at.  Uses current window only.
ved_stop        (UNIX 4.2 only)
    Suspend current process, taking you back to the CSHELL.
    Restart by typing '%' to CSHELL.
ved_sw
    Transpose two characters to to left of cursor.
ved_swl
    Swap current word with word on left. Uses space as
    delimiter.
ved_swr
    Swap current word with word on right. Uses space as
    delimiter
ved_yankl
    'Undelete' last line deleted with vedlinedelete
ved_yankw
    'Undelete' last portion of line deleted using
     vedwordleftdelete, vedwordrightdelete, vedclearhead, or
     vedcleartail.  ved_xdn
    Scroll other window down. Also done by <ESC> <LF>
    buttons.
ved_xup
    Scroll other window up. Also done by <ESC> <BS>
    buttons.
ved_xx
    Write all altered files, exit from VED, exit from POP11

Additional more complex examples of things that can be done in the vedinit.p file are illustrated in the file HELP INITIAL.EX.

Creating saved images

Users may find that compiling a library file and a vedinit.p file with a lot of VED tailoring commands can take some time. POPLOG allows facilities to 'pre-compile' such things and creates a 'saved' image which can then be invoked using the mechanisms described in HELP INITIAL.

Usually it is advisable to create a DCL or SHELL command file that can be run in order to create your saved image. Once it is created it can be started up quickly, and can be made to take you straight into VED as soon as it starts.

Examples of how to do this sort of thing are given in the file HELP INITIAL.EX. However, it is usually wise to get help from an experienced POP-11 programmer when this is first done.

INDEX: The VED commands described in the user guide

ENTER / <RETURN> Search forward  (see ved_search)
        Can include patterns.
      (if no string provided, use last search string)
ENTER " <RETURN> Search forward, but only for
        complete word, or number, etc.
      (if no string provided use last search string)
ENTER \ <RETURN> Search backward. No patterns allowed.
      (if no string provided use last search string)
ENTER @a <RETURN> Move to beginning of file
ENTER @m <RETURN> Move to beginning of marked range
ENTER @z <RETURN> Move to end of file
ENTER @99 <RETURN> Move to line 99
ENTER 99  <RETURN> Move to line 99
ENTER ac <RETURN>
    centres each line in marked range between left and
    right margins
ENTER al <RETURN>
    aligns first character of each line in marked range with
    the left margin
ENTER ar <RETURN>
    aligns last character of each line in marked range with
    the right margin
ENTER bc <RETURN>
    moves the marked range left or right so that the first
    line of the range is centred between the two margins
ENTER bl <n> <RETURN>
    moves the marked range <n> characters to the left,
    n defaults to 1
ENTER br <n> <RETURN>
    moves the marked range <n> characters to the right,
    n defaults to 1
ENTER break <RETURN>
    switches the line break mechanism on and off
ENTER c <RETURN>
    Compiles all program files and returns to POPLOG.
ENTER c1 <RETURN>
    Just compile (load) the current file and return to
    POPLOG. Compiles even if file is unchanged.
ENTER centre <string> <RETURN>
    Puts string at centre of current line. If string is empty
    or '.' moves existing line of text to centre.
ENTER clear <RETURN>
    Delete everything from the current file
ENTER d <RETURN>
    Delete marked range
ENTER dcp <RETURN>
    Delete current procedure
ENTER deof <RETURN>
    Delete to end of file, from current line, inclusive.
ENTER doc <file> <RETURN>
    Get DOC file
ENTER files <RETURN>
    Print out information about current files in the editor
ENTER fill <RETURN>
    Justify marked range as if in text file (even if not)
    See ENTER j, ENTER jcp, ENTER jp, ENTER fp
ENTER fp <RETURN>
    Fill current paragraph (even if in a program file).
    See ENTER fill <RETURN>
ENTER gobble <RETURN>
    remove excess spaces from the marked range, leaves a
    single space between words. See ENTER jj <RETURN>
ENTER gs/string1/string2 <RETURN>
    Global substitute. If no arguments, then use last ones.
    Use " as string delimiter, to restrict to complete words.
    E.g. ENTER gs"cat"cats will not alter "catch". If string1
    is empty (i.e. just ENTER gs//string2 <RETURN>)
    then use last search string. If no argument provided
    (i.e. just ENTER gs <RETURN>) then use last search
    string and last substitute string.
    See ENTER gsr <RETURN>, ENTER gsp <RETURN>,
    ENTER sgs <RETURN>
ENTER gsl <RETURN>
    Global substitute in current line
    - like ENTER gs <RETURN> in current line.
ENTER gsp <RETURN>
    Global substitute in current procedure. Leaves it marked.
ENTER gsr <RETURN>
    Global substitute in marked range.
    Like ENTER gs <RETURN>.
ENTER help file <RETURN>
    Get HELP file
ENTER indent N <RETURN>
    Alter the size of the tab setting.
ENTER j <RETURN>
    Justify marked range. Fills if it is a text file, does
    indentation if a program file (ENTER tidy <RETURN>).
    See ENTER fill <RETURN>.
ENTER jcp <RETURN>
    Justify current procedure, using ENTER tidy <RETURN>
ENTER jj <RETURN>
    Fully Justify marked range. Aligns left and right margins
ENTER jjp <RETURN>
    Fully justify current paragraph.
ENTER jp <RETURN>
    Justify current paragraph if text file, procedure otherwise
ENTER l <RETURN>
    Like ENTER c <RETURN>, but doesn't return to POPLOG
ENTER l1 <RETURN>
    Like ENTER l <RETURN>, but loads only current file
    (even if unchanged)
ENTER lcol <N> <RETURN>
    Set the left margin. If no number given, then use cursor
    position.
ENTER lcp <RETURN>
    Load current procedure. Uses ENTER lmr <RETURN>.
ENTER lcw N <RETURN>
    Lower case words. Transforms next N words to lower
    case. N defaults to 1. See ENTER ucw <RETURN>.
ENTER lcl N <RETURN>
    Lower case lines. Like lcw, but for lines. Moves to next
    line.
ENTER lcr <RETURN>
    Lower case range. Transform marked range to lower case.
ENTER lib <name> <RETURN>
    Load a library file
ENTER lmr <RETURN>
    Load (compile) marked range from edit buffer.
ENTER load <file.p> <RETURN>
    Load the file.
ENTER m <RETURN>
    Move marked range to after current line.
ENTER mi <file> <RETURN>
    Move a marked range of text from one file into the
    current file
ENTER mo <file> <RETURN>
    Move a marked range of text from the current file into
    another file
ENTER mbe <RETURN>
    Mark current file from Beginning to End
ENTER mbf <RETURN>
    Mark from beginning of file
ENTER mbp <RETURN>
    Mark from beginning of procedure
ENTER mcp <RETURN>
    Mark whole of current procedure
ENTER mef <RETURN>
    Mark to end of file
ENTER mep <RETURN>
    Mark to end of current procedure
ENTER name <new name> <RETURN>
    Rename a file
ENTER name <RETURN>
    Print out name of current file
ENTER output <RETURN>
    Used to redirect output
ENTER pop <RETURN>
    Return to POPLOG
ENTER pved <file> <RETURN>
    Call VED in 'protected' mode. You cannot write <file>
ENTER q <RETURN>
    Quit current file. Compare ENTER rrq <RETURN>
ENTER qhelp <file> <RETURN>
    Quit current file and call HELP with new one
ENTER qpop <RETURN>
    Quit the current file and return to POPLOG
ENTER qq <RETURN>
    Quit from VED and from POP-11, returning to operating
    system. Asks if you want to write any changed files
    before you quit.
ENTER qshowlib <file> <RETURN>
    Quit current file and call SHOWLIB with new one
ENTER qteach <file> <RETURN>
    Quit current file and call TEACH with new one
ENTER qved <file> <RETURN>
    Quit current file and start editing new one
ENTER rb <RETURN>
    Rotate Buffers in VED. Uses current window only.
ENTER rcol <N> <RETURN>
    Make N the right most column. If no number given,
    then use cursor position.
ENTER ref <file> <RETURN>
    Get REF file
ENTER right <string> <RETURN>
    Puts the string at right of current line
ENTER rqq <RETURN>
    Really Quit from VED and Quit from POPLOG
    without asking questions
ENTER rrq <RETURN>
    Really Really Quit current file without asking questions.
ENTER s/<search string>/<substitute string> <RETURN>
    Substitute search string with substitute string, repeatedly
    if necessary. If substitution is OK press <RETURN> to
    do more, or Y meaning Yes and stop. If not OK press
    <DEL> to search for another, or N meaning No and stop.
    If search string is empty, use last search string. If no
    argument given (i.e. just ENTER s <RETURN>) then use
    the last search string and last substitute string. String
    delimiter can be any sign character. If " is used as delimiter,
    then replace only whole words. See ENTER gs <RETURN>,
    ENTER gsr <RETURN>, ENTER gsp <RETURN>.
ENTER sgs <RETURN>
    Like ENTER gs <RETURN>, but "silent", that is it
    doesn't record every substitution on the command line.
ENTER showlib <file> <RETURN>
    Read the library file into VED.
ENTER t <RETURN>
    Transcribe marked range to after current line.
ENTER ti <file> <RETURN>
    Copy a marked range of text from one file into the
    current file
ENTER to <file> <RETURN>
    Copy a marked range of text from the current file into
    another file
ENTER teach <file> <RETURN>
    Get a TEACH file
ENTER ucw <n> <RETURN>
    Upper Case Words. Transforms next <n> words to
    upper case. <n> defaults to 1.
ENTER ucl <n> <RETURN>
    Upper Case Lines. Transforms next <n> lines to upper
    case.
ENTER ucr <RETURN>
    Upper Case Range. Transform marked range to upper case.
ENTER ved <file> <RETURN>
    Start or resume editing the file.
ENTER w <RETURN>
    Write ALL changed files to disk
ENTER w <file> <RETURN>
    Write the current file to the name given.
ENTER w1 <RETURN>
    Write only current file
ENTER wq <RETURN>
    Write current file and quit
ENTER wqved <file> <RETURN>
    Write current file, quit it, then call VED with new file
ENTER wr <file> <RETURN>
    Write marked range to file
ENTER wved <file> <RETURN>
    Write current file, then call VED with the new file
ENTER x <RETURN>
    Write all changed files, then compile program files, then
    return to POPLOG
ENTER x1 <RETURN>
    Write and load current file and return to POPLOG.
    Compiles even if unchanged.
ENTER xx <RETURN>
    Write all altered files, exit from VED, exit from POPLOG
ENTER yank <RETURN>
    To retrieve text deleted with ENTER d <RETURN>,
    ENTER deof <RETURN>, ENTER dcp <RETURN>
    and ENTER clear <RETURN>
ENTER y <RETURN>
    A shorthand for ENTER yank <RETURN>
ENTER yankl <RETURN>
    Retrieves the last line of text deleted with the
    LINEDELETE key
ENTER yankw <RETURN>
    Retrieves the last line of text deleted with the
    CLEARHEAD or CLEARTAIL key, or word deleted with
    one of the word delete keys.

GLOSSARY

A:
argument - parameter given to a procedure for it to work on
arrow keys - the four keys after the function keys at the top
             of the v55, v200, and vt100 keyboards.
B:
break mode - if this is on then lines are automatically
             broken when they reach the rightmost column.
             If it is off, lines are not broken.
C:
centre - align a line of text midway between the left and
         right margins
command line - Line at the top of a VED window from which
               to give commands. Output is sometimes
               displayed here. Tells you the current line
               and file the cursor is in.
copy - text copied from one place to another. The original is
       not removed.
compilation - translating user's input into executable machine
              code
current window - The window the cursor is in
cursor - small symbol, such as a rectangle or underscore
         character, showing where you are on the screen
D:
delimiter character - a character used to separate different
                      parts of a string. For example "/" and
                      '"' in search and substitute commands,
                      and "." in file names.
directory name - a file which lists the files taking up a
                 particular area on the disk.
disk name - the name of a disk where directories are kept
E:
embedded match - two items will match if they share the
                 same characters regardless of the
                 surrounding boundaries.
exact match -  two items will match only if they share both
               the same characters and boundaries.
F:
filespace - an allocation of quota on disk which houses your
            directory
footer - text appearing at the bottom of a page
form feed character - a non-printing character which tells a
                      printing device to begin a new page
full justification - align the first and the last characters on each
                     line with the left and right margins
                     respectively.
function keys - the keys at the top of the v55 and v200
                keyboards marked F1 to F12 and F0 to F13
                respectively.

G: global substitution - non-interactive substitution

H:
header - text appearing at the top of a page
home key - the key next to the arrow keys at the top of the
           v55 and v200 keyboards
host name - the name of a computer e.g. CVAXA or UNX1
I:
incremental compilation - compiling without having to re-link
insert mode - the normal character insertion mode.
interactive substitution - commands that wait for confirmation
                           before replacing the search string
                           with the substitute string in the
                           text
K:
keypad keys - the keys forming a separate block on the
              right-hand side of a keyboard. These usually
              have numbers and may have symbols
L:
left justified - first character on each line aligned with left
                 margin
library procedure - a procedure that is only loaded when it is
                    used, or needs to be explicitly loaded
load - the same as "compile"
M:
MISHAP message - a message produced by the procedure
                 MISHAP telling you about mistakes in
                 your programs.
monitor - a command interpreter e.g DCL, SH, CSH
move - text moved from one place to another eliminating it
       from the original place.
N:
non-interactive substitution - commands that replace the search
                               string with the substitute
                               string in the text without
                               waiting for confirmation.
NROFF  - UNIX printing program
O:
operating system - program, e.g. VMS or UNIX, controlling
                   system resources such as disk space and
                   processor time.
P:
paging - insertion of page breaks, page numbers, headers and
         footers on a printing device
printout - paper version of a file, as produced by a printer
Q:
quit - remove a buffer from the bufferlist
R:
replacement string - an alternative term for "substitute string".
right justified - last character on each line aligned with right
                  margin
RUNOFF - VMS printing program
S:
search string - the argument you give to a search procedure to
                search for.
static mode - character insertion mode where existing characters
              are over-written, and the <RETURN> key is
              disenabled.
status line -  an alternative word for the "command line".
string - POP-11 vectors whose elements occupy one byte
         (i.e. they must be positive integers less than 128)
substitute string - the second argument you give to a search and
                    substitute procedure. VED replaces occurrences
                    of the search string in the text with the
                    substitute string.
T:
toggle - successive key presses switches the associated
         behaviour on and off alternately
V:
VED buffer - VED's temporary copy of a single file. It is a
             vector containing strings representing successive
             lines of the current file.
VED bufferlist - a list of the current VED buffers
vedfile - refers to the structure that VED keeps for every file it
          is editing which includes the vedbuffer and other
          information e.g. where marked ranges are
VED window - a section on the terminal screen providing a
             window into a VED file
W:
wild card - a dummy character used to stand for anything
words - a word is a letter followed by a series of letters or
        numbers. A word can also be a series of
        non-alpha-numeric characters
write - transfer a file from the bufferlist to the disk

--- C.all/doc/veduserguide --------------------------------------------- --- Copyright University of Sussex 1987. All rights reserved. ----------