TEACH VED Revised A.Sloman Oct 1995 Using VED to create your own files ================================== - REVISION ------------------------------------------------------------ It is assumed that you have already worked through TEACH TEACH, and that you already know how to use the SCREENDOWN and SCREENUP keys to read a teach file. Also you should have learnt how to move the VED cursor in eight different directions using the right hand keypad, how to use the ENTER key to give commands on the command line, how to use the WORDLEFT and WORDRIGHT buttons on the right hand keypad, and how to use the top function keys F3 to F5 for Deleting line to left of cursor Deleting whole line Deleting line to right of cursor. Also you should know how to change the window size use ESC w, and how to quit a file using ESC q, and finally how to log out. -- WHAT YOU NEED TO LEARN NEXT ---------------------------------------- You need to become fluent with a range of additional operations using VED. You may find it a bit tedious learning these things, but if you do learn them then your later work will be much easier. In particular, you need to know how to start creating a file of your own, how to type things into it and change them when you make mistakes, how to resume work on the same file the next time you log in. You will also need to learn how to "mark a range" in VED. Once you have learnt how to mark a range all sorts of things will be become easier. You will be able to copy a range to another part of the same file, or to a new file, or move the range, or delete the range, or "tidy" the range. Also, once you start writing programs using VED you will be able to "load" or compile a marked range, and that should enormously speed up your program development compared with many other techniques. If you are already very familiar with using word processors or editors on computers, you may find that some of the teach files are a little tedious for you. In that case you can skim instead of working through all the details, until you start learning about the language Pop-11 and how to program in it. This file introduces VED commands that go beyond what you learnt from TEACH TEACH. In particular it shows you how to create your own files. -- KEYBOARD MAPS ------------------------------------------------------ NB - In order to work through this teach file, you will need to make use of a keyboard map showing where to find the different function keys on your keyboard. In many of the TEACH files the "angle brackets" < ... > are used to indicate a key that has a name written on it, e.g. When you see things like that you should not type the "<" and ">" symbols. Just look for a key with that name on it. It is strongly recommended that you make short notes as you read on, to help you remember how VED works. -- INTRODUCTION ------------------------------------------------------- VED is a program for creating and altering files. For example, all the teach files were created with VED. Files are like documents in a filing cabinet, except that they are stored on a magnetic disc attached to the computer. In roughly the same way that a filing cabinet has separate drawers, so the disc is divided into areas called directories. One of these is your own personal directory, into which VED will put any files that you create. In this way, your files will not be confused with anyone else's. (VED knows which directory to use because you gave your "login" name when you logged in.) The disc is the computer's long term memory. The computer also has a short term memory which is used when programs are running. You are now reading a file which has been copied from the long term memory to the short term memory in order for you to look at it. When you create files using VED you work in the short term memory. From time to time you will need to ensure that your file is copied from the short term to the long term memory, so that you can access it if you come back again after logging out. Among the things you need to learn is how to start editing a file, how to finish and save it on the disc, how to move around the file you are editing, how to insert text, how to delete text, how to copy or move bits from one part of the file to another. VED has commands for all of these actions, and many more. Some of the commands are done by pressing a special key. Some require you to press a sequence of keys. Some are done by giving a command on the command line. The TEACH TEACH file that you started with introduced examples of all these commands. If you have trouble remembering them, you should go back to that file as follows: Press: the key type: teach teach press: the key When you have finished with that file you can QUIT it with the command Press: type: q press: to get back to this file. Such commands are often abbreviated as q or just q Sometimes the teach files omit the angle brackets, as in : ENTER q Read on using the SCREENDOWN key. -- TEACH AND VED COMMANDS --------------------------------------------- VED and TEACH are two ways of calling up the same system - so you are already partially familiar with VED. The POP-11 command teach window tells the system that you want to use VED to look at the teach file called WINDOW. (Remember - that was the one that told you about using w to see a larger window on the screen.) Similarly, you can use the POP-11 command ved vednotes to tell VED you want to work on a file of your own, called 'vednotes'. There are two important differences between the TEACH and VED commands: 1) TEACH looks for files in a special directory of teach files, while VED uses your own directory. 2) VED allows you to put new files, or altered versions of old ones, into long-term storage in your directory on the disc. Although TEACH permits you to change the copy of the teach file that you are looking at, it won't store the changed version on disc. So you don't have to worry about damaging teach files. No matter what you do to the text displayed on your screen, the copy of a TEACH file in long-term storage remains intact. Since VED and TEACH are just different names for the same system, the TEACH commands like SCREENUP work in VED too. The same applies to other commands that you have already learned. -- VEDKEYS -------------------------------------------------------------- Many terminals now have, besides the normal typewriter keys, additional keys referred to as "function keys". They may have marks on them, like F1, F2, F3, etc. Or they may have other symbols such as arrows or letters. These keys, when pressed, transmit special signals to the computer. VED can be told to respond to such a signal by doing something that would otherwise require you to press several keys. So pressing a function key can save you time and effort. You have already learnt from the TEACH TEACH file that there are keys called SCREENDOWN and SCREENUP and other keys for moving the cursor around. Depending on the terminal you are using there may also be keys for moving a "word" at a time, left or right, deleting chunks of text, "marking" a chunk of text, moving or copying a chunk of text, and performing other tasks. Your system administrator, tutor, or Poplog supplier should provide you with a keyboard map for the kind of terminal you are using (unless VED has not been customised for your terminal). Most terminals do not have sufficient function keys for all the tasks VED has to perform. There are two additional ways commands can be given. One, which you have met from the first TEACH file, uses an ENTER command. E.g. 1 jumps to the top of the file, and bye can be used to leave POPLOG. In addition some commands are based on special sequences of keys. These will depend on how your terminal has been set up. The TEACH files will assume certain defaults. -- CURSOR MOVEMENT ------------------------------------------------------- You should already know how to move the cursor about the file, using the SCREENUP and SCREENDOWN keys and keys that do small moves up, down, left and right: CHARUP, CHARDOWN, CHARLEFT, CHARRIGHT. On some terminals there are also keys for diagonal moves, or for bigger moves in the eight directions. There may also be PageDown and PageUp keys. Near the SCREENUP and SCREENDOWN key there are usually SCREENLEFT and TEXTRIGHT (or SCREENRIGHT) keys, with arrows. One key that is often useful, is the key, marked LF on some terminals. This positions the cursor at the beginning of the next line. It can therefore sometimes be referred to as the NEXTLINE key. Its effect is like CHARDOWN plus SCREENLEFT. If your terminal does not have a LINEFEED key you can simulate it with CTRL-j, i.e. hold down the button (on the left usually) marked "CTRL" or "Control", and while it is held down press the "J" key (once). Now do it again, to see what happens. The WORDLEFT and WORDRIGHT keys are also useful for moving within a line. Practice using all those cursor movement keys until you feel very familiar with their operation. -- INSERTING NEW TEXT ------------------------------------------------------ Inserting new text is very simple. You simply position the cursor at the point where you want the new text to appear and then type in the new text. Try doing that now. Put the cursor here -> and type your name, or anything else. If you make a mistake, press the CHARDELETE key and see what happens. CHARDELETE deletes the last character you typed, i.e. the character to the LEFT of the cursor. (On some keyboards without a key the or key is given this role.) Sometimes the key deletes the character where the VED cursor is rather than the character to the left. You can insert text in the middle of a line, and everything to the right moves over to make space for the new text. Try inserting letters here -> in the middle of this line. Everything moves to the right. If the line gets too big for the screen, it will split automatically. Try making that happen. (This automatic splitting will not happen when you use VED to create programs.) -- DELETING TEXT ------------------------------------------------------ To remove text, position the cursor directly after the text to be deleted and press the DELETE key once for each character you want to remove. Just for practice remove the asterisks HERE: ***** Notice how things on the right shift left to fill the vacant space. Also the cursor keeps moving left as characters are deleted. -- OTHER DELETE KEYS -------------------------------------------------- On many keyboards there is a key given the role of deleting the CURRENT character i.e. the one the cursor is on. For accidental historical reasons this is sometimes called the DOTDELETE key (the "dot" character "." being used in some systems to denote "here".) The keyboard map may say something like "DELETE CHAR HERE". Sometimes it is the BACKSPACE key. If you can find such a key on your keyboard map, put the cursor on the "1" on the next line and repeatedly press the key: HERE-> 123456789. This time the cursor does not move left as characters are deleted, but things to the right of the cursor still move leftwards to fill the gap. You can also delete a whole word at a time. Using the WORDLEFTDELETE and WORDRIGHTDELETE keys. These may be marked on the top of your keyboard, or on your keyboard map. Put the cursor on the middle of the line below and experiment with those two keys. EXPERIMENT ON THIS LINE WITH THE KEYS FOR DELETING WORDS Notice how they sometimes delete a space, sometimes a word and a space. They do this in a manner that corresponds to the way the WORDLEFT and WORDRIGHT keys move the cursor. Look on your keyboard map for keys labelled CLEARHEAD LINEDELETE CLEARTAIL or DELETE LINE LEFT DELETE WHOLE LINE DELETE LINE RIGHT These are often the keys labelled F3, F4 and F5. The first of these will delete the characters to the LEFT of the cursor, on the same line (the HEAD of the line). The second will delete the WHOLE line containing the cursor. The third deletes all characters to the RIGHT of the cursor, INCLUDING the character at the cursor location (the TAIL of the line). Experiment with these three keys by putting the cursor in the middle of lines a few paragraphs up and pressing them so that you become familiar with their action. Try typing a line of text below this line then pressing the CLEARHEAD key: HERE -> On many terminals you can use CTRL-u as a CLEARHEAD key (i.e. hold down the CTRL key, and tap the "U" key). -- BREAKING LINES AND ADDING NEW LINES -------------------------------- The RETURN key can be used to break lines of text. Position the cursor in the middle of some line and then press the RETURN key. As you will see VED breaks the line into two. The RETURN key inserts a "new line" You can also use the RETURN key to insert a new line in some text by putting the cursor at the end of a line, then pressing RETURN. Try that method of putting a new blank line above this one. I.e. go to the end of the line, and then press RETURN. You'll get a new blank line. You can remove it by pressing the CHARDELETE key. On some terminals there are special keys that will add a new line before or after the current line. On the keyboard map they will be referred to as LINEABOVE and LINEBELOW. Try to find them and experiment with them. (E.g. often on an X terminal, the the key above the Delete key will add an extral line.) -- MERGING LINES ------------------------------------------------------ If you press CHARDELETE (usually the key) when the cursor is at the beginning of a line, the 'gap between lines' is deleted; that is the line with the cursor and the line above are joined together. Put the cursor at the beginning of the next line (this line) and press CHARDELETE. Then press to break the lines again. Practice breaking and joining lines. -- AUTO-BREAK --------------------------------------------------------- If you are typing in text and get close to the right hand side of the screen then VED will insert a new line for you automatically. Try that now. Position the cursor at the end of the next line and start typing in words, without pressing the RETURN key. Do it over HERE -> You'll see how VED automatically breaks the line. (It doesn't do this when used for program files, whose names end with '.p' or '.lsp' or '.pl' etc.) -- LONG LINES --------------------------------------------------------- If a line won't fit on the screen because it is too long, then VED will display just the first part of the line. However, if you press the CHARRIGHT key again and again the cursor will move to the right hand side of the screen and all the text on the screen will scroll or jump left in a manner analogous to the way it moves up with the CHARDOWN key. Put the cursor on THIS very long line and try pressing the CHARRIGHT key lots of times. To bring back the cursor to the beginning of the next line, press LINE FEED or SCREENLEFT. Notice how a long line is indicated by a mark on the right of the screen. -- USING x TO SWITCH FILES -------------------------------------- When you start creating your own files you will need to be able to switch between your own file and the teach file telling you what to do. You can learn how to do that by looking at another TEACH file. Try teach switchwindow You can finish that file with the command: q Try looking at it now. The TEACH SWITCHWINDOW file should explain to you how you can use the key followed by the X key to switch back and forth between two files. More generally, x switches to the last file you were editing before the current one. If that file is not already on the screen, then it will be inserted in the upper half. You can subsequently use x to move between the two files on the upper and lower halves of the screen. -- REVISION QUESTIONS ------------------------------------------------- How do you delete a character to the left of the cursor? How do you delete the character under the cursor? How do you delete the word to the left of the cursor? How do you delete the word to the right of the cursor? How do you delete part of a line to the left of the cursor? How do you break a line somewhere in the middle? How does VED indicate that a line is too long to be shown in full? What does the LF (or Linefeed) key do? How do you insert some characters in the middle of a line? How do you merge two lines? How do you insert a new line above or below the current line? How is x used? After you have learnt how, by reading on, put the answers to these questions in a file called VEDNOTES, for future reference. -- CREATING A FILE OF YOUR OWN ---------------------------------------- At last you are ready to start creating your own files! Read all of this section carefully before doing any of the examples in it. There are important instructions towards the end. So far, all you've done is modify a copy of the teach file for VED. Now is the time to try creating a file of your own. The first thing to do is think up a name for your file. Filenames can have a mixture of letters or digits in them. Exactly what sorts of characters can be included in a file name depends on the operating system. VMS is far more restrictive than UNIX, but unless you know exactly what you are doing it is a good idea to include only letters, numbers, the dot "." and the underscore "_" (not to be confused with the hyphen ("-"). Some versions of UNIX (System V Unix) allow only 14 or fewer characters in a file name. If you don't know the limits on the system you are using ask an expert. WARNING: On Unix systems you will be allowed to create file names containing special characters, but if you do you may later have great difficulty deleting, copying, or printing the files. The characters most likely to cause trouble include these, so please avoid them in file names: question mark "?", asterisk "*", less than "<" greater than ">", exclamation mark "!", vertical bar "|" a space " " In particular if you include "*" or "?" or a space in your file name on UNIX, you may have a lot of trouble later trying to delete it without deleting some of your OTHER files. So here are some possible file names: foobaz This is okay my_file This is okay my-file This is okay letter_to_my_mum This is too long for some Unix systems. file3 This is okay 3file Some systems won't allow a number first secret This is okay, but it's a give away name myprog.p The 'suffix' tells VED that it is a POP-11 file program.pl The 'suffix' indicates a Prolog file functions.lsp The 'suffix' indicates a Lisp file You could give your file a name based on your own name. E.g. if your name is Sally you could call the file 'sally1'. (Use lower case rather than capitals.) Alternatively if you are going to use your first file to store notes on the editor, call it 'vednotes'. Let's say that you've decided to call your first file sally1 (or your name followed by a number). To tell VED that you want to work on a file called sally1 you can do the following, and when you start the new file, come back to this one by typing x. Here is how to start a new file of your own, or continue working on an old file of your own: (a) Press: ENTER (b) Type: ved sally1 (Use DELETE key to correct mistakes) (c) Press: RETURN When you do this (assuming you don't yet have a file with the name you have chosen) VED will tell you that it is starting a new file. This teach file (TEACH VED) will still be available in VED, and you can come back to the same place. In fact it may remain visible in part of the screen. (d) You can then type in something, eg a summary of the VED commands, a poem, or any old nonsense. Use the " teach" command, or " x" to get back here after you have started your new file. You should spend a few minutes typing some notes into your other file, to make sure that you can do it easily, and correct mistakes, and so on. Type some notes in your other file summarising how to start up a new file in VED and how to switch between two files. You could also add information on how to move the cursor, delete words, and so on. -- SCROLLING THE "OTHER" FILE UP OR DOWN LF and BS -------- While you are typing in your own file, the cursor will be in the new window and the SCREENUP and SCREENDOWN keys will move the cursor within that window. If you wish to read more of this file you can use x (as explained in TEACH SWITCHWINDOW) to come back to this file, then press SCREENDOWN to get more of this file on the screen, then use x to go back. That can be a bit tedious, so VED has a "shorthand" method of doing that by means of the (or ) sequence. If you don't have a Linefeed or LF key, replace it with CTRL-J, i.e. do CTRL-J. That is, you can still scroll THIS file in the other window, using to get the effect of SCREENDOWN. Try it by going to your other file with x then pressing a few times to read more of this. (or CTRL-J) You can also scroll the "other" file UPwards by using followed by the key (sometimes marked BS). So is equivalent to: x SCREENDOWN x while is equivalent to: x SCREENUP x -- SUMMARY AND QUESTIONS ---------------------------------------------- It's a good idea to use your first file to type in a summary of what you've learnt about using the editor. E.g. call it 'vednotes' and in it type answers to these questions. What do the following do: Pressing the ENTER button Pressing the CHARDELETE key in the middle of a line Pressing the CHARDELETE key at the beginning of a line Pressing the RETURN key with the cursor in middle of a line Typing ESC then w Typing ESC then x Typing ESC then pressing the LINE FEED key Typing ESC then pressing the BACK SPACE key Pressing the keypad keys on the right How do you delete a whole word at a time? How do you insert text? How do you split a line in the middle? How do you start creating a new file of your own? Which keys delete whole line, line to left, line to right? How do you quit a file? -- SWITCHING BETWEEN A TEACH FILE AND YOUR OWN FILE ------------------- You may want to switch back and forth between reading this teach file and editing your own file. If you are editing a file of your own, you can get back to the last TEACH file you were reading file by doing: teach You can get back to editing your own file by giving the command: ved Just as the TEACH command remembers what teach file you are working on, so the VED command remembers what file of your own you have most recently been editing, if you give it no name. Alternatively, the x (eXchange files) command can be used. -- WRITING FILES TO THE DISC : w ------------------------------ Occasionally VED will "beep" and print out a message saying that it is automatically saving your files. It will save a copy of what you have done so far on the magnetic disc where your files are kept, so that your work is safely stored if something goes wrong, e.g. there is a power failure and the machine suddenly stops. You can force VED to save all your work so far on the disc, at any time, by giving the command: w to "write" your files to the permanent store on the disc. If you have only been looking at TEACH files it will do nothing. But if you have been working on your own files it will see if any of them have had any changes made since last being "written", and if so it will write them, ie. save them on the disc. It is a good idea to type w every time you have made some significant changes to your file, especially if you are temporarily stopping, e.g. to read something or talk to someone. When you leave POPLOG with the ' bye' command it will write your files automatically. However, the "quit" command ' q' described below is different. -- LEAVING A FILE WITH q -------------------------------------- If you have started typing a file in for practice and decide you don't want it stored on the disc, then you should put the cursor into the file concerned and give the command: ENTER q (ie.. q for QUIT). If you have typed or deleted something in the file, VED will check that you really do want to abandon the result of your efforts. VED will say, on the command line something like: FILE CHANGED. WRITE IT? Type 'y' OR 'n' OR 'c' TO CONTINUE You should normally respond by pressing the Y key, i.e. say "YES" you want VED to write the file on to the magnetic disc, so that you can get at it again when you next log in. If the file contains only rubbish that you don't want saved, You can press the N key to quit without saving the file. q Does not ask for confirmation when you quit a TEACH file. If you have made some changes to it they will simply be ignored, so that next time you look at the file it will be in its original state. However, if you quit a file of your own after you have done something to it, this could be a slip, and VED checks so that your work is not all lost. Try the following: ved junkfile (or choose a name of a file that you already have, but have not yet done any work on). Then type in or delete some characters in the file. Then do q Because it is your own file, VED will say, on the command line: FILE CHANGED WRITE IT? TYPE 'y' 'n' or 'c' TO CONTINUE If you type just 'c' VED will abandon the QUIT command and the cursor will go back to where it last was. Try that, i.e. q, then press the C key. Then do q again, and this time type just 'n'. The file will be abandoned and left as it was originally on the disk, if there was one, or the new file you've created will not be stored. You should only type 'n' when you really want to ABANDON the work you have done. Normally you should type 'y' and your file will be saved on the disk. Try editing one of your files again, type something into it, do q, then respond 'y'. You'll see VED say that it is writing the file. If you then edit it again you will see that your changes are still there. After quitting your file you can then leave POP-11 and log out, or do something else. -- PRINTING YOUR FILES ------------------------------------------------ When you have finished putting something in your file, you can ask the computer to print it on the line printer. How to do this varies from one site to another. Look at TEACH * PRINTING for details. You will probably need help from a tutor or demonstrator to get started with printing. -- LEAVING POPLOG WITH BYE ------------------------------------ If you've had enough for now and want to log out then you can leave VED with the command: ENTER bye -- Related TEACH files ------------------------------------------------ TEACH BUFFERS shows how you can switch between different files when you have more than two files in the editor. You will want to do this once you begin writing POP-11 programs, so you should read TEACH BUFFERS next. If you want to continue now, then quit this file and try TEACH MARK - this tells you how to mark ranges in a file. Then if you want to use the editor for typing in programs, try TEACH LMR - this tells you how to COMPILE a marked range in a program file. TEACH VEDPOP - gives you an introduction to using the editor to create POP-11 programs. If you are not interested in programming, try: TEACH MOREVED - it describes some of the more advanced editing facilities, including an introduction to searching commands in VED. If you are developing programs it is not as important as TEACH MARK, LMR and VEDPOP. -- HELP FILES ----------------------------------------------------------- There is a command HELP, similar to TEACH, that gives you access to a directory of help files. Help files give brief descriptions of the usage of various terms in POP-11, eg. HELP VED is a summary of VED facilities for more experienced users. -- USING g A TABLE OF CONTENTS -------------------------------- Read on to see how to use the table of contents below to jump to a required portion of this file. CONTENTS OF THIS FILE -- WHAT YOU NEED TO LEARN NEXT -- KEYBOARD MAPS -- INTRODUCTION -- TEACH AND VED COMMANDS -- VEDKEYS -- CURSOR MOVEMENT -- INSERTING NEW TEXT -- DELETING TEXT -- OTHER DELETE KEYS -- BREAKING LINES AND ADDING NEW LINES -- MERGING LINES -- AUTO-BREAK -- LONG LINES -- USING x TO SWITCH FILES -- REVISION QUESTIONS -- CREATING A FILE OF YOUR OWN -- SCROLLING THE "OTHER" FILE UP OR DOWN LF and BS -- SUMMARY AND QUESTIONS -- SWITCHING BETWEEN A TEACH FILE AND YOUR OWN FILE -- WRITING FILES TO THE DISC : w -- LEAVING A FILE WITH q -- PRINTING YOUR FILES -- LEAVING POPLOG WITH BYE -- Related TEACH files -- HELP FILES -- USING g A TABLE OF CONTENTS -- USING THE TABLE OF CONTENTS -- USING THE TABLE OF CONTENTS ---------------------------------------- Many of POPLOG's teach and help files have an index formatted like the above table of contents. Sometimes the index is at the beginning of the file, rather than at the end, like this. If you wish to go direct to a part of the file mentioned in the table, you can put the cursor on the appropriate line in the table and then press the key sequence: g If you simply give that command now, then VED will jump to the start of the index. Try it now, as follows, after you have read down to the row of asterisks: Press Type g Press This will take you to the top of the table. Move the cursor down to the entry for a section you would like to look at again, using using the CHARDOWN key, and then repeat the command g to look at the section. To get back to the table use the same command. Try all that now. ******************************************************** --- C.all/teach/ved --- Copyright University of Sussex 1987. All rights reserved. --- $poplocal/local/teach/ved --- The University of Birmingham 1995. --------------------------------