TEACH USEFULKEYS Aaron Sloman, Sept 1997 This file introduces some of the most important among the basic VED keyboard commands, for use when developing and testing programs. Additional information is available in other files. CONTENTS - (Use g to access required sections) -- Moving the Ved cursor -- The central keypad cluster -- Modifier keys -- The ESC key -- Loadline: ESC d -- Moving to a specified line number -- Moving to a section of the file -- Further information -- Leaving this file -- Moving the Ved cursor ---------------------------------------------- Try to identify the "Ved cursor", usually a rectangular blob which determines the "current" line and the "current" column in the editor. You need to become fluent with the "arrow" keys on the keyboard, which move the Ved cursor around in the text. Try the arrow keys now. Note how the line number in the "status line" at the top of the text window changes as the Ved cursor moves up and down. If you use the up or down arrow keys to push the Ved cursor off the top or the bottom of the window, the window will "scroll" down or up to show the previous or next line of text. Moving left or right a word at a time is often convenient. Look at the numeric keypad at the right of your keyboard. Try the keys marked "0" and "." at the bottom of the keypad (also marked "Ins" "Del" on most keyboards). Those move the Ved cursor a word at a time, left and right, including moving to previous or next line when necessary. Try them. -- The central keypad cluster ----------------------------------------- Your keyboard may have a small group of six "function" keys to the right of the main bank of keys, above the arrow keys, labelled thus: +--------+--------+--------+ | Insert | Home | Page | | | | Up | +--------+--------+--------+ | Del | End | Page | | | | Down | +--------+--------+--------+ NB the Del or Delete key in this cluster (usually a bit to the right of the Backspace key) is different from the Del key at the bottom right. The Del in the central cluster does not move a word right. Instead you can use it to delete a character to the left of the Ved cursor (if your terminal has been set up properly). Try it on the text in this line: here's some XXXXrubbishYYYY to delete. The PageUp and PageDown keys perform larger moves, i.e. moving back to the previous portion of text above the current window, and moving down to the next portion. If your keyboard doesn't have them try: Control key+V (simultaneously) to move down a window at a time ESC key followed by v to move up a window at a time. (You may have to repeat those commands to get the same effect as PageUp and PageDown.) Depending on how your terminal has been set up the Backspace key may also delete a character to the left of the Ved cursor, or the character UNDER the Ved cursor. Try the backspace key on the text in this line. (It is possible to alter how the keys behave in Ved. But you can learn about that later.) Note 2: You may be used to actions that function keys perform in connection with some other package, e.g. a word processor or spreadsheet. Do not assume the keys will work in the same way with Ved. The keys marked "Home" and "End" in the central keypad cluster move the Ved cursor to the beginning or end of the file. The key marked "Insert" in the central cluster should insert a blank line above the current Ved line. -- Modifier keys ------------------------------------------------------ Some of the keys on the keyboard insert printable characters into the text you are typing, e.g. the alphanumeric keys and the symbol keys. Others, are called "function keys", e.g. the arrow keys and the keys at the top and on the right of the keyboard, which can be used to give commands, as explained later. Some keys do not do anything on their own, but can be used to modify the effects of other keys. The main ones are "Shift" (sometimes marked with an arrow pointing up) and "Control" and "Alt" or "Meta" keys. These modifier keys are held down SIMULTANEOUSLY with other keys to modify their behaviour. Shift does so by making letters come out in upper case, and also enables you to get the upper symbol on keys that have two symbols. The only ones you are likely to need for now are "Shift" and "Control" (often abbreviated as "CTRL"). The Control key, like the Shift key, does not produce a printable character on its own. What it does when you are using Ved depends on the context and the key you use. Here are some examples, for you to try. Control+P (moves the Ved cursor uP) Control+N (moves the Ved cursor dowN) Control+F (moves the Ved cursor Forward (right)) Control+B (moves the Ved cursor Backward (left)) Control+T (Transposes the two characters to left of cursor) Control+V (Move down a screenful) Try all of those: i.e. hold down the Control key, and try tapping the other keys listed: P, N, F, B, T a few times. Doing Control+T twice should swap two characters then swap them back. If you try Control+V, you'll need to use the PageUp key, or up-arrow key to get back. Sometimes these Control commands are indicated by putting the character "^" before the letter, e.g. ^P, ^N, ^F, etc. Sometimes these are written as CTRL+P, CTRL+N, etc. -- The ESC key -------------------------------------------------------- Another way to modify the behaviour of a key on the keyboard is to PRECEDE it with the ESC key (sometimes labelled "Escape"), which is often somewhere on the upper left of the keyboard. (On Suns it is usually to the left of the "1" key). Unlike Shift and Control, you do not use ESC simultaneously with another key. Rather you should press and release it BEFORE the other key, because unlike the other keys it sends a signal of its own to the computer, which is then interpreted as meaning: treat the following key (or keys) in a special way. Think of it as meaning "Escape temporarily from the normal context to a special context". E.g. try out the following ESC followed by f (moves the Ved cursor a word Forward (right)) ESC followed by b (moves the Ved cursor a word Backward (left)) ESC followed by u (turns a word into Upper case) ESC followed by l (TURNS A WORD INTO Lower case) ESC followed by . (Changes the case of the current character) ESC followed by v (Move up screen. Undo with CTRL-v or PageDown). Experiment with those commands in this file. They are usually abbreviated as: ESC f, ESC b, ESC u, ESC l, etc. Note that if you hold the SHIFT key down, or if you have set CAPS LOCK on then the ESC character will be followed by an upper case letter and its behaviour may be different. E.g. "ESC b" moves backwards, but the sequence "ESC B" is undefined and will simply cause the terminal to "beep" (or it may be defined to do something else.) -- Loadline: ESC d ---------------------------------------------------- A particularly useful command when programming is the sequence ESC d, which you can try with the Ved cursor on this line (where "*" means "multiply" in Pop-11): 999 * 50 => ESC followed by d (tells Ved to ask Pop-11 to "Do" the current line = loadline. Mnemonic: "D" for "doit") The Ved loadline command should be given only when the Ved cursor is on a line containing a Pop-11 command. It tells Pop-11 to "load the current line". (Later this will be explained more fully.) The symbol "=>" called the Pop-11 "print arrow" (made of two characters "=" followed by ">") ensures that any result produced by the preceding command, i.e. the number calculated in the above example. is printed in Ved's 'output.p' file, preceded by two asterisks, thus: ** 49950 -- Moving to a specified line number ---------------------------------- You can give a command on the status line to move to a particular line number. Note the line number the Ved cursor is on now (the number is visible on the status line at the top of the window). Then give this command to move to line 25, followed by a similar command to return to the current line: ENTER 25 This means press the "ENTER" key on the far right of the keyboard, type the number 25, then press the "RETURN" to complete the command. (The RETURN key is usually immediately to the right of the alphabetic keys. It may have a "bent" arrow pointing left.) When you press the ENTER key it should move the Ved cursor onto the "status line", and clear the line, so that you can type a line number to go to or a command for Ved to obey. Pressing RETURN says the command is read for Ved to obey. After the command is obeyed, the Ved cursor is returned to the text in the file. If you press RETURN when there is no command or the command is not recognized you'll hear a "beep" and see a short error message displayed. Note: if the keyboard does not have an ENTER key, or if it does not seem to work, you can use CTRL+g instead. If you have keys marked "Home" and "End" they should be set up to take you to the beginning or end of the file. Memorise the current line number (on the status line) then experiment with the Home and End keys, then use the "ENTER " command to get back here. If your terminal has been set up correctly you should also be able to move the Ved cursor by using the mouse pointer. Select a character with the mouse and click on button 1 (the left button). If you are using Ved in plain text mode this may not work, and you'll have to use the keyboard keys to move the cursor. -- Moving to a section of the file ------------------------------------ You may remember that near the begining of this file there was a table of contents. You can use the "ENTER g" command (think of "g" for "Go") - to move to the table of contents from anywhere in the file, or - to move from the table of contents to a section listed there. Note the heading of this section, and try the ENTER g command first to get to the table of contents and then again to get back here. I.e. press: the ENTER key (extreme right) type: g press the RETURN key To get here, you'll have to move the Ved cursor onto the right section heading in the table of contents before repeating the ENTER g command. -- Further information ------------------------------------------------ Later, when you are more fluent in Ved and wish to find out lots more commands and shortcuts, you can look at additional online information. At Birmingham there's a very useful overview in the file TEACH VEDNOTES Additional information about the use of ESC and Control key sequences can be found in HELP VEDKEYS There are also summary files for different keyboards, e.g. HELP NCDXTERMKEYS -- Leaving this file -------------------------------------------------- If you were reading another file before you started this one, and would like to return to the previous file you can Quit this file, with the following sequence: ESC q I.e. makes sure "Caps Lock" is not ON, then press and release the key marked "Esc", and then press and release the key marked "Q". That should "quit" this file and take you back to the preceding one, if there was one. If there was no preceding file it may cause Ved or Xved to "exit", leaving you to type commands to the Unix system. --- $poplocal/local/teach/usefulkeys --- Copyright University of Birmingham 1997. All rights reserved. ------