TEACH QUICKVED Jeremy Wyatt Jan 1998 Updated Aaron Sloman Oct 1998 This file gives a compact introduction to the essentials of VED, the Poplog text editor. It contains only the basic commands you need to start editing and creating files. For a longer introduction look at TEACH * TEACH, TEACH * VED, TEACH * SWITCHWINDOW, TEACH * BUFFERS, and TEACH * MARK. This file assumes that you are using XVED and the Poplog menu system. It also assumes you are using either a DEC ALPHA, or an NCD X-terminal, or a Sun, or a PC configured to run the X window system. -- READING THIS FILE --------------------------------------------------- To read this file you will need to be able to move round it. To move up and down press the or key on your keyboard. If you can't see these use your mouse to click on the corresponding buttons on the menu (marked Toplevel) to the right of this window. If you can't find those then ask someone nearby for help. Words surrounded by the < and > signs in this TEACH FILE refer to single keys on your keyboard. You can always read on using the downward arrow key, though that can be slow. -- WHAT ARE VED AND POPLOG? -------------------------------------------- VED is part of a powerful programming environment called Poplog. Poplog is based around an AI programming language called Pop-11, though Poplog also includes other languages (Prolog, Common Lisp and Standard ML). Pop-11 is a language that allows you to write complex AI programs quite quickly. In order to write programs you obviously need a text editor. VED is Poplog's text editor. It can be used to write, save, and modify programs. It can also be used to produce documentation, such as the file you are now reading, and also to read and send email messages and even essays and reports. (There are text formatting facilities, you can learn about later.) You can also run the programs and debug them from within the editor. XVED is a version of VED that works with the X-window system. The X-window system is the program that controls the graphical display you are now looking at, and allows you to create multiple windows and use the mouse. One important feature of Poplog is that it has an extensive on-line help system. This file is called a TEACH FILE. It and the other TEACH FILES and HELP FILES explain how to write simple programs in Pop-11; the syntax of the language; and some of the fundamental ideas in AI. Teach files are tutorial in style; Help files are more advanced. In this teach file we'll look at how to open and use the online help system; and how to create, edit and save your own files. Poplog was originally developed at Sussex University and is now Marketed worldwide by Integral Solutions Ltd (ISL). If you wish to find out more about Poplog, information is available at these internet sites: ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/poplog.info.html http://www.cogs.susx.ac.uk/users/adrianh/poplog.html -- WAYS OF MOVING ABOUT ------------------------------------------------ When you use VED (or XVED) there is always a ``current line'' and a ``current location'' within the current line. This location is usually represented on the screen by the ``text cursor'', a rectangular block which moves if you press one of the arrow keys on your keyboard. If you type something, e.g. "hello" the characters will be inserted at the text cursor location. If you press the Del or Backspace key a character will be deleted where the text cursor is. There is also a mouse cursor, which moves when you move the mouse. Its appearance is different in different contexts. If you are using XVED it may look like an 'I' when it is in the XVED window, otherwise a small arrow. While reading or editing text you need to move the text cursor, to change the ``current location'' in the file. There are lots of ways of moving the current location. One of the simplest is to use the arrow keys on your keyboard. Try using these to move it about now. See what happens when you move far to the left or the right, or a long way up or down. The second way to move the current editing location is to use the mouse. Move the mouse cursor to a point in this window and click the left mouse button. The text cursor should jump to the same place as the mouse cursor. Note: the current location changes ONLY when you click, not whenever you move the mouse. Another way to move about if you are using XVed is to use the mouse on the ``scroll bar'' normally at the right hand side of the window. Yet another is to use the PageUp and PageDown keys in the central keypad. Some people who type quickly like to keep their hands over the alphabetic part of the keypad. You can use CTRL-v to move down and ESC v to move up, a window at a time. Try several different ways of moving the edit location about now. -- THE COMMAND LINE ---------------------------------------------------- At the top of the current Ved window you will see a number and the name of this file. The number is the line you are at in this file (i.e. the current line number). You can see it change as you move the cursor up and down the file. That line is called the COMMAND LINE, since you can type commands there. It is also sometimes called the STATUS line since it shows (some aspects of) the current state of the editor. You can perform all sorts of useful operations using it the command line. To get the text cursor there you can click on it with your mouse, or press the key on your keyboard -- usually at the extreme right of the keyboard. (Don't confuse it with the key, which does other things.) If for some reason your ENTER key does not work you can use CTRL-g . You can also move round the file by typing in line numbers to the command line. First memorise the current line number. Now type in a new number, then press the key. e.g. 200 Use the same mechanism to come back here. If you mistakenly hit and want to leave the command line, press the + key on the numeric keypad to the far right of your keyboard. Notice what happens when you press that key repeatedly. It is called the STATUSSWITCH key in VED. -- CREATING A NEW FILE OF YOUR OWN ------------------------------------ How can you open a file of your own to write in? The answer is to use the command line. Don't carry out the following instructions right away. Wait until you reach the end of this section. Go to the command line, and type VED MYNOTES. You should not type in capital letters. They have simply been used to distinguish the commands you must use from the rest of the text. If you make a mistake then use the or keys to correct it. The key may be marked as a lefthand arrow <--. When you have finished typing the "ved mynotes" command on the command line, press the key to tell VED that the command is ready to be obeyed. Then another XVED window will appear. It will be empty (unless you had previously created a file called 'mynotes'). You should see the characters '(EDITING: mynotes)' on the command line. To come back to this Teach file go to the command line in that window and give the " teach quickved" command. You can call up any TEACH file in the entire Poplog system by typing on the command line "teach" followed by the filename then . You can open your own files (or create new ones) for editing by typing "ved" followed by the filename on the command line. -- SWITCHING BETWEEN WINDOWS USING THE MOUSE -------------------------- You can also switch between existing windows using the mouse. If the window you want is fully visible, just move the mouse into it. You can then type in the window (unless your window manager has been set to "click to change focus"). If the window is partly covered you can bring it to the "front" by clicking on the title bar. The title bar is a horizontal bar at the top of the window which includes the name of the window and maybe some icons. It will change colour as you move the mouse cursor in and out of the window. (If it doesn't you may be using a different window manager from the default one used at Birmingham, called "ctwm"). Move the mouse to the title bar at the top of the window you want to use, and click on that bar with the LEFT mouse button. It will come to the "front". You can send it to the "back" by clicking on it again, exposing the windows it previously covered. Experiment with left button clicks on title bars of various windows to see what happens. (NB: whether all this works as described will depend on which window manager you are using and how it has been set up. If you change your window manager things will work differently.) You can also switch between Ved windows by tapping the key, letting go, and typing X. Normally this command sequence would be written x or ESC x. (This invokes VED's SWAPFILES function, which enables you to switch back and forth between the last two VED windows. (NB do NOT try hitting the two keys and X simultaneously. The key sends a separate signal to the computer which must be received first. It is not like the and keys which send no separate signal but modify the signals sent by other keys.) -- MOVING AND RESIZING WINDOWS ---------------------------------------- VED windows (and others) take up a lot of space, so switching between them can be awkward if you wish to be able to see both windows at the same time. You can resize windows and move them using the mouse. Exactly how to do that depends on the window manager and how it has been set up. What follows will work for users at Birmingham the default setup using the "ctwm" window manager. Things may be different if you are working elsewhere. To MOVE a window around put the mouse cursor on the title bar at the top of the window, then press the LEFT key and hold it down. A "move frame" will appear, and as move the mouse (still holding the middle key down) the frame will move with it. Release the mouse button when you are happy with the new location. The window will then jump to the move frame's location. To make a window smaller or larger you'll need to click on the right-most icon on the title bar for the window -- the "Resize icon": it is a square containing two "L" shaped lines. Move the mouse cursor onto the resize icon and then press the left mouse button and hold it down. A "resize frame" will appear. You can then move the mouse cursor to resize the window. There are two main ways to do that. Resize method 1: You can "attach" mouse cursor to the top right corner of the window by moving the cursor up to the right (keeping the mouse button down all the time). The corner of the resize frame will "follow" the mouse, changing the size of the frame. You can then drag the corner down to reduce the size of the frame. When you release the mouse button the window will expand or contract to fit the resize frame. Resize method 2: After you click on the resize button, the resize frame appears, as before. Now drag the mouse cursor towards the centre of the window, then "attach" it to one of the four edges of the window. You can then move that edge in or out, to change the height or width. Alternatively "attach" it to one of the corners, by moving it out diagonally through the corner. When you release the button the window size will change to fit the resize frame. As the resize frame changes size a small window will appear at the top left of your screen giving the size of the window. If it is an XVED or xterm window the size will be measured in columns and rows of characters, Other window sizes are measured in window "pixels". In a window for editing it is usually desirable to have a width of at least 80 columns. However if you make the window wider then when you try to print a file later on, it may not look good because lines will have to be broken to fit on the page. Try changing the size of this window. Keep the window as wide as it is now, and just make it shorter by moving the bottom edge upwards, or the top edge downwards. Now resize both your VED windows and move them and the menu panel until you can easily see and switch between them all. -- CHANGING AN XVED WINDOW'S SIZE USING XVED'S MENU ------------------- If you didn't like that method of changing a window's size then you can just click on the WindowSize button in the VED menu window. If the menu with label "Toplevel" is not visible bring it up by giving the "ENTER menu" command. One of the buttons on the menu panel is labelled "WindowSize". Click on it repeatedly until you get the size you want. (It will go through a range of smaller sizes then larger sizes then return to the original as you click repeatedly). If you have more than one XVED window, move the mouse cursor into the XVED window you wish to resize before clicking on the "WindowSize" button. If you are not using XVED the window size will not change, but as you click VED will alternate between using the full window and half the window for the current file. -- ICONISING A WINDOW ------------------------------------------------- Sometimes you may wish to make a window temporarily inaccessible, by replacing it with a small window containing only the window's name (and possibly a pictorial reminder of the time). This means replacing the window with a window "icon". Sometimes it is called "closing" the window (which is not what "close" means on a PC). The easiest way to close (iconise) a window in the CTWM window manager as set up by default at Birmingham is to click in the window's title bar with the RIGHT mouse button. You may think the window has disappeared completely but you will find a small icon somewhere (near the bottom right probably) with the name of the window you have just closed. If you click on the icon the window will "open" again and jump back to where it was previously. -- EDITING AND SAVING FILES -------------------------------------------- Now you can start to edit your file. Switch to the window containing your file called 'mynotes', and type some text, after first locating the VED cursor where you wish to type. You should probably write a brief summary of what you have learned about how to use VED and the window manager. This will take about ten minutes, and will help you review what you already know. You can use the or keys to correct typing mistakes. You may find it useful to include notes on how to start a new file in VED, how to give VED commands, how to move the VED text cursor, how to move or resize a window. If you're confused or have questions about any of this, now is a good time to ask. You can compare your notes with those written by other students. How can you "save" your file so that it is stored on a hard disk? Go to the command line (press ), type W (lower case) and press . The w command tells VED to "write" all your files to the magnetic disk where they will be saved until you next need them. Now let's "quit" the file: type q . The window containing 'mynotes' will disappear, and the text cursor will end up back in this window. To view your file once more give the command " ved mynotes" as previously. If you make some changes and then try to quit without saving first, VED will ask you if you would like to save the changes you made. You should select the "save" option so that you don't lose work. Remember that if you quit a file without saving you will lose all your changes. It is sensible to save your files whenever you have made significant changes, about every 15 minutes is a good guide. Depending on the operating system you are using there may be restrictions on the filenames you can use. A good rule of thumb is to use only alphabetic and numeric characters and the '_' underscore character. Do not try using punctuation characters, spaces, or "*" or "?" in a file name. If you create a Pop-11 program file as described below, make sure that its name ends in '.p', as in 'myfile.p'. That will tell VED to treat the file as containing Pop-11, rather than just plain text. But don't use the '.p' suffix for files that are not program files, since then VED will not format them nicely for you. -- MARKING TEXT -------------------------------------------------------- VED allows you to manipulate sections of text as well as individual characters. To perform any operation on a section of text you must select it. To do this you need to use the row of function keys at the top of the keyboard. These are marked , , etc. If you don't have such function keys on your keyboard you will need to ask for help. You may find that other keys will do, or you may be able to get by using VED's Menu panels. If you wish to mark a range of text, prior to copying it, deleting it, formatting it, or compiling it you must first decide which is the first (top) line of the range. Move the text cursor onto that line then press the function key. A vertical line will appear next to this line on the left hand side of the window. If you are using a colour screen it will be red. Now move the text cursor down to the last line in the range and press . and you will see the line on the left extend to the line the cursor is now on. This is called marking a range. The lines of text you have marked are called the MARKED RANGE. Try marking one of the visible paragraphs in the file you are reading. Then extend the range to include a paragraph above it. (You will need to use the UpArrow key and . Then extend the range down to include the next paragraph after the marked range. You will have to use the DownArrow key and . Another way to mark a range in XVED is to use the mouse cursor and the Control key on the keyboard. Move the mouse cursor to the top of the previous paragraph. Then press the Control key, and while holding it down "drag" the mouse cursor holding button 1 down. The red mark on the left will appear as soon as you move the cursor. Release the buttons when you have finished. But how can you perform useful operations with this marked range? First of all let's copy some text within the same window. Mark one of the paragraphs visible above, then move the text cursor cursor to the empty space below this paragraph and press . The entire marked range will be copied to that space. Notice that the line on the left showing which range is marked stays where it is. An alternative to pressing the key, which will work even if your keyboard has not been set up correctly is to give the VED " t" command. ("t" is short for "transcribe"). You can also move a marked range around. This time mark the copied text, and move the cursor below this paragraph. Now press . The block of text will move. If the F8 does not have the desired effect you can give the " m" command to move text. The line on the left moves with the marked text. You can delete a marked range by giving the d command. Try that now and the marked paragraph will disappear. If you accidentally delete a range you can retrieve it using the command y, where "y" stands for "Yanking" the deleted text back into the file. Finally you can unmark a marked range with crm. This is short for "Clear Range Mark"). You may wish to clear the range mark to prevent unwanted deletion, copying or moving. You can read about marking ranges in more detail in TEACH * MARK. There is a summary available in the file HELP * MARK. To read it give the command help mark. There is also a "marking" menu available via the "toplevel" menu panel. Incidentally, don't worry about any changes you make to this file. All Teach files are "write protected". This Teach file doesn't change on disk when you change your on screen copy of it, and you cannot save your changes to a Teach or Help file, unless you first rename the file to make it one of yours. You'll learn how to do that later. -- COPYING RANGES BETWEEN FILES ---------------------------------------- Before proceeding, make sure you have a file called 'mynotes' which has been opened in VED as described above. Move the text cursor to the end of that file (e.g. using the function key or the " @z" command. Then come back to this file. We've just seen how to copy or move a marked range between different parts of the same file. It is often useful to be able to copy text blocks from one file to another. How can you do this? Simply mark a paragraph in this file, then switch to the other window using x. That should take you to your file mynotes. To copy (or "transcribe") the marked range from the teach file into the mynotes file, First move the text cursor to where you want the text to appear, then give the command "ENTER ti". (Transcribe In). This will copy (transcribe) the marked range from the previous file to the current file. (A slightly quicker alternative is to use the key sequence You can also MOVE text between windows. Mark a new block in 'mynotes', and switch back to this file. Then give the command " mi" (where "mi" stands for "Move In"). That will move the marked range from the previous file to the current file. Alternatively you can use the key sequence: (The and keys will work on terminals set up in the school of computer science in Birmingham. Terminals elsewhere may work differently.) When you use the mi, or , command you should see the block of text disappear from one file and reappear wherever the cursor is in the other file. Now mark the moved block and delete it. You may want to practice this several times. -- JUSTIFYING TEXT ----------------------------------------------------- When you make lots of changes to a piece of text, it often becomes untidy. To make it flow neatly down the page you can try the key sequence j. This will "justify" the paragraph that the cursor is currently in. Try it out on the paragraph below. This paragraph is very untidy. The lines of text sometimes finish halfway across the screen. But the j key sequence will justify it. However it will not be exactly right-justified with lines exactly the same length as that would require inserting some extra spaces. I.e. it will be justified with "ragged right" format. -- LOGGING OUT --------------------------------------------------------- Before logging out you should make sure you finish your XVED session. You will want to save all the files you have created and leave Poplog altogether. You can perform both these functions with one command: bye. If you have any changed files that will save them on the disk. (Though not TEACH files.) Try leaving Poplog like that now, and then restart using the XVED unix command followed by teach quickved. You will then need to reopen your notes file 'mynotes' from the command line. Remove any junk from that file and add to the notes a summary of how to mark ranges, move or copy them, and delete them. When you are ready to log out, you can click on the small window at the top labelled "Exit" or "Quit". Always make sure you have terminated any programs you were running BEFORE you do that, e.g. XVED, Netscape, Xemacs, etc. -- SUMMARY ------------------------------------------------------------- You have now met a number of VED commands and key sequences: Four arrow keys (Up Down Left Right) q (or q) w x j bye (or m) (or t) (or mi) (or ti) ved 'filename' teach 'filename' d crm y Copy this list into your file mynotes and write a one line explanation for each one. You have also seen how to use the mouse to move the text cursor use the menu use the scrollbar Finally you have learned the following skills on-line TEACH and HELP files creating, editing and saving your own files to disk moving around and between windows marking ranges moving, deleting, and copying marked ranges how to use the command line Make sure that you understand and practice these by writing a summary in your file 'mynotes' before moving on. -- MORE MOVEMENT ------------------------------------------------------- Although you now know several ways of moving around there are several other useful shortcuts. You can move word by word across the screen. F moves you to the right, and B moves you to the left. Remember that when you use the key you just tap it once, don't hold it down. When you've released then hit the F or B key. You can also move to the beginning and end of a line of text. A moves you to the beginning of a line of text, and E moves you to the end. stands for the key marked CONTROL. It should be in the bottom corner of your keyboard. When using the key in commands you should hold it down and then hit the other key, e.g. E, while is still depressed. Another really useful way of moving around is to use tables of contents provided in TEACH files. To go to the table of contents for this file use the mouse to click on the GoSection button in the menu. Then place the cursor on the line of the topic you would like to jump to. Then click again on GoSection. The cursor will automatically jump to that section. You can jump back to the table of contents at any time by clicking on GoSection. Try doing this now. -- JUMPING BETWEEN BUFFERS --------------------------------------------- XVED normally allows you to have two windows, but you might open many more files than that. When you open an file it is placed in what is called a buffer. A buffer is just a piece of memory that stores the text, and the changes you make to that text. Each window can displays the contents of one buffer. So you can display the contents of up to two buffers at once. When you type W you save the contents of all the current buffers to disk; and when you type Q you close a buffer, so that the only version left is the one on disk. You may of course have many buffers open, but using X you can only jump between the buffers currently visible in your two windows. The other buffers are hidden. To view a list of the other opened buffers type E. This will give a numbered list of buffers with their associated filenames. To go a buffer simply type the corresponding number. You can do this even if you only have two buffers open. Try this now. -- SUMMARY ------------------------------------------------------------- This Teach file has given a very brief overview of the minimum commands you need to perform simple editing in XVED. To help remember these you should complete your summary in 'mynotes' before moving on to other Teach files that tell you about Pop-11. -- INTRODUCTORY TEACH FILES -------------------------------------------- This Teach File covers only the rudiments of VED. It also covers the material very quickly, If you have found difficulty with any of the material or would like to know more about VED now, then you should read some of the more detailed Teach Files about VED (on which this file is based). TEACH * TEACH A longer tutorial introduction to text editing in VED TEACH * RHYME Gives you practice with VED - unscrambling a scrambled poem. TEACH * EMAIL Explains how to read and send email in VED TEACH * VED More information and practice on creating your own files TEACH * SWITCHWINDOW Revision on the use of "ESC x" to switch between files TEACH * BUFFERS How to deal with several different files at once. TEACH * MARK Revision on the use of marked ranges in a file. Note: In VED's online documentation you will often see an asterisk after a word like TEACH or HELP. If the VED text cursor is higher up you can use the key sequence n to move it to the NEXT asterisk. Then to get the help or teach file into VED use . This can be quicker than typing a full help or teach command. -- WHAT TO READ NEXT --------------------------------------------------- You should now move on to the Teach files which introduce the most basic ideas of programming in Pop-11. Your course tutor may suggest one or more of these. TEACH * FACES A very rapid introduction to graphics programming in Pop-11 using Ved as a development environment. Make some smiling and sad faces. TEACH * LMR How to mark and compile part of a Pop-11 program file. It explains some of the types of error messages that can occur and how to learn from them. TEACH * VEDPOP More practice with basic Pop-11 instructions in the VED environment. TEACH * VEDPROC A sequel to TEACH * VEDPOP, showing how to define Pop-11 procedures in VED. HELP * VEDNOTES A summary of the most frequently used subset of VED commands. HELP * XTERMKEYS Maps of the keyboard function keys, showing what they do in VED and XVED HELP * VEDKEYS A reminder of most of the things that can be done in VED using key sequences. For more advanced users only: TEACH * TEACHFILES - overview of TEACH documentation in the Poplog system TEACH * LOCALINDEX - List of teach files available in this department. HELP * HELPFILES - overview of HELP documentation HELP * LOCALINDEX - List of help files available in this department. TEACH * PRIMER - A lengthy overview of the main features of Pop-11. A printed version of this can be bought from the librarian in the School of Computer Science at the University of Birmingham. -- TABLE OF CONTENTS --------------------------------------------------- CONTENTS ======== This table of contents is at the end of the file. The contents list can appear anywhere in a file. In some teach and help files the table is near the top of the file. To go to a section move the text cursor to the line in the table of contents and give the command g, Alterntiavely you can bring up VED's Toplevel menu if it is not already visible, using the command menu, and then on the GoSection button in the menu panel. If the text cursor is not already in the table of contents the above commands will make it jump to the table of contents and select the line after the last one on which you gave the "g" command. -- READING THIS FILE -- WHAT ARE VED AND POPLOG? -- WAYS OF MOVING ABOUT -- THE COMMAND LINE -- CREATING A NEW FILE OF YOUR OWN -- SWITCHING BETWEEN WINDOWS USING THE MOUSE -- MOVING AND RESIZING WINDOWS -- CHANGING AN XVED WINDOW'S SIZE USING XVED'S MENU -- ICONISING A WINDOW -- EDITING AND SAVING FILES -- MARKING TEXT -- COPYING RANGES BETWEEN FILES -- JUSTIFYING TEXT -- LOGGING OUT -- SUMMARY -- MORE MOVEMENT -- JUMPING BETWEEN BUFFERS -- SUMMARY -- INTRODUCTORY TEACH FILES -- WHAT TO READ NEXT -- TABLE OF CONTENTS --- $poplocal/local/teach/quickved --- $poplocal/local/rcmenu/teach/quickved --- Copyright University of Birmingham 1999. All rights reserved. ------