Annotation of 43BSDReno/contrib/jove/doc/teach-jove, revision 1.1.1.1

1.1       root        1:                      J O V E   T U T O R I A L 
                      2: 
                      3: Welcome to JOVE - an advanced, easy-to-use, user-friendly environment 
                      4: for editing text, programs or anything else you may like to type.
                      5: 
                      6: JOVE commands generally involve the CONTROL key (sometimes labelled
                      7: CTRL or CTL) or the META key (generally labelled ESCAPE).  Rather than
                      8: write out META or CONTROL each time we want you to prefix a character,
                      9: we'll use the following abbreviations:
                     10: 
                     11:  C-<chr>  means hold the CONTROL key while typing the character <chr>
                     12:          Thus, C-F would be: hold the CONTROL key and type F.
                     13:  M-<chr>  means type the META (ESCAPE) key and release it, then type
                     14:          the character <chr>.  The <chr> can be upper or lower case
                     15:          and it will have the same meaning.
                     16: 
                     17: Important note: if you must exit at some point, type C-X C-C.
                     18: The characters ">>" at the left margin indicate directions for you to
                     19: try using a command.  For instance:
                     20: 
                     21: >>  Now type C-V (View next screen) to move to the next screen.
                     22:        (go ahead, do it by depressing the control key and V together).
                     23:        From now on, you'll be expected to do this whenever you finish
                     24:        reading the screen.
                     25: 
                     26: Note that there is an overlap when going from screen to screen; this
                     27: provides some continuity when moving through the file.
                     28: 
                     29: The first thing that you need to know is how to move around from
                     30: place to place in the file.  You already know how to move forward a
                     31: screen, with C-V.  To move backwards a screen, type M-V (depress the
                     32: META key and type V, or type <ESC>V if you don't have a META or EDIT
                     33: key).
                     34: 
                     35: >>  Try typing M-V and then C-V to move back and forth a few times.
                     36: 
                     37: 
                     38: SUMMARY
                     39: -------
                     40: 
                     41: The following commands are useful for viewing screenfuls:
                     42: 
                     43:        C-V     Move forward one screenful
                     44:        M-V     Move backward one screenful
                     45:        C-L     Center the current line--clear screen and redisplay
                     46:                everything if current line is already at center.
                     47:        
                     48: >> find the cursor and remember what text is near it.
                     49:    Then type a C-L.
                     50:    Find the cursor again and see what text is near it now.
                     51: 
                     52: 
                     53: BASIC CURSOR CONTROL
                     54: --------------------
                     55: 
                     56: Getting from screenful to screenful is useful, but how do you
                     57: reposition yourself within a given screen to a specific place?  There
                     58: are several ways you can do this.  One way (not the best, but the most
                     59: basic) is to use the commands previous, backward, forward and next.
                     60: As you can imagine these commands (which are given to JOVE as C-P,
                     61: C-B, C-F, and C-N respectively) move the cursor from where it
                     62: currently is to a new place in the given direction.  Here, in a more
                     63: graphical form are the commands:
                     64:  
                     65:                          Previous line, C-P
                     66:                                  :
                     67:                                  :
                     68:    Backward, C-B .... Current cursor position .... Forward, C-F
                     69:                                  :
                     70:                                  :
                     71:                          Next line, C-N
                     72: 
                     73: You'll probably find it easy to think of these by letter.  P for
                     74: previous, N for next, B for backward and F for forward.  These are the
                     75: basic cursor positioning commands and you'll be using them ALL the
                     76: time so it would be of great benefit if you learn them now.
                     77: 
                     78: >> Do a few C-N's to bring the cursor down to this line.
                     79: 
                     80: >> Move into the line with C-F's and then up with several C-P's.  See
                     81:    what C-P does when the cursor is in the middle of the line.
                     82: 
                     83: Lines are separated by a single Linefeed character, which is what Unix
                     84: calls a Newline.
                     85: 
                     86: >> Try to C-B at the beginning of a line.  Do a few more C-B's.
                     87:    Then do C-F's back to the end of the line and beyond.
                     88: 
                     89: When you go off the top or bottom of the screen, the text beyond the
                     90: edge is shifted onto the screen so that your instructions can be
                     91: carried out while keeping the cursor on the screen.
                     92: 
                     93: >> Try to move the cursor off the bottom of the screen with C-N and
                     94:    see what happens.
                     95: 
                     96: If moving by characters is too slow, you can move by words.  M-F
                     97: (Meta-F) moves forward a word and M-B moves back a word.
                     98: 
                     99: >> Type a few M-F's and M-B's.  Intersperse them with C-F's and C-B's.
                    100: 
                    101: Notice the parallel between C-F and C-B on the one hand, and M-F and
                    102: M-B on the other hand.  Very often Meta characters are used for
                    103: operations related to English text whereas Control characters operate
                    104: on the basic textual units that are independent of what you are
                    105: editing (characters, lines, etc).  There is a similar parallel between
                    106: lines and sentences: C-A and C-E move to the beginning or end of a
                    107: line, and M-A and M-E move to the beginning or end of a sentence.
                    108: 
                    109: >> Try a couple of C-A's, and then a couple of C-E's.
                    110:    Try a couple of M-A's, and then a couple of M-E's.
                    111: 
                    112: See how repeated C-A's do nothing, but repeated M-A's keep moving
                    113: farther.  Do you think that this is right?
                    114: 
                    115: Two other simple cursor motion commands are M-< (Meta Less-than),
                    116: which moves to the beginning of the file, and M-> (Meta Greater-than),
                    117: which moves to the end of the file.  You probably don't need to try
                    118: them, since finding this spot again will be boring.  If you need the
                    119: shift key to type a "<", then you must also use the shift key to type
                    120: M-<.  Otherwise, you would be typing M-, .
                    121: 
                    122: The location of the cursor in the text is also called "point".  To
                    123: paraphrase, the cursor shows on the screen where point is located in
                    124: the text.
                    125: 
                    126: Here is a summary of simple moving operations including the word and
                    127: sentence moving commands:
                    128: 
                    129:        C-F     Move forward a character
                    130:        C-B     Move backward a character
                    131: 
                    132:        M-F     Move forward a word
                    133:        M-B     Move backward a word
                    134: 
                    135:        C-N     Move to next line
                    136:        C-P     Move to previous line
                    137: 
                    138:        C-A     Move to beginning of line
                    139:        C-E     Move to end of line
                    140: 
                    141:        M-A     Move back to beginning of sentence
                    142:        M-E     Move forward to end of sentence
                    143: 
                    144:        M-<     Go to beginning of file
                    145:        M->     Go to end of file
                    146: 
                    147: >> Try all of these commands now a few times for practice.  Since the
                    148:    last two will take you away from this screen, you can come back
                    149:    here with the command C-X C-X (which will be explained later).
                    150:    These are the most often used commands.
                    151: 
                    152: Like all other commands in JOVE, these commands can be given arguments
                    153: which cause them to be executed repeatedly.  The way you give a
                    154: command a repeat count is by typing META and then the digits before
                    155: you type the command.  (Remember META is ususally called ESCAPE)
                    156: 
                    157: For instance, META 8 C-F moves forward eight characters.
                    158:        
                    159: >> Try giving a suitable argument to C-N or C-P to come as close
                    160:    as you can to this line in one jump.
                    161: 
                    162: The only apparent exception to this is the screen moving commands, C-V
                    163: and M-V.  When given an argument, they scroll the screen up or down by
                    164: that many lines, rather than screenfuls.  This proves to be much more
                    165: useful.
                    166: 
                    167: >> Try typing M-8 C-V now.
                    168: 
                    169: Did it scroll the screen up by 8 lines?  If you would like to scroll
                    170: it down you can give an argument to M-V.
                    171: 
                    172: 
                    173: 
                    174: THE UNIVERSAL ARGUMENT
                    175: ----------------------
                    176:    Almost every command in JOVE takes a so-called Universal Argument.
                    177: This argument, although it is interpreted differently in some cases,
                    178: usually means REPEAT.  One important exception to this is with the screen
                    179: moving commands.  In this case, the number refers to the number of LINES
                    180: to scroll, not the number of screens.
                    181: 
                    182:    The way you give a command a universal argument is by typing ESC and
                    183: then the number. For example, ESC 10 C-F would move you forward ten
                    184: characters.
                    185: 
                    186: >>> Try  giving a suitable argument to C-N or C-P to come as close as you
                    187:     can to this  line  in  one  jump.  Then  try giving the same command, 
                    188:     except make the number negative.
                    189: 
                    190:   Another count-giving command is C-U.  This command, when you first type
                    191: it, gives you an argument of 4 (four).  If you type C-U C-U, you will get
                    192: an argument of 16.  Each time C-U is typed, the argument is multiplied by
                    193: four.
                    194: 
                    195: >>> Try typing ESC 8 C-V now.
                    196: 
                    197: THE GOTO COMMAND
                    198: ----------------
                    199:    Now that we've learned about the universal argument, we can  introduce
                    200: another  cursor  positioning  command,  the command to move to a specific
                    201: line.  This command is given by giving a line number via  ESC,  and  then
                    202: typing M-G.
                    203: 
                    204: >>> Try  using  the M-< and M-> commands to move to the beginning and the
                    205:     end of the file. Then come back here  using the M-G  command (this is 
                    206:     line 206, so you'd type ESC 206 M-G.)
                    207: 
                    208: QUITTING FROM COMMANDS
                    209: ----------------------
                    210: 
                    211: The character in JOVE used to quit out of all commands which request
                    212: input is C-G.  For example, you can use C-G to discard a numeric
                    213: argument or the beginning of a command that you don't want to finish.
                    214: 
                    215: >> Type M-100 to make a numeric arg of 100, then type C-G.  Now type
                    216:    C-F.  How many characters does it move?  If you have typed an <ESC>
                    217:    by mistake, you can get rid of it with a C-G.
                    218: 
                    219: 
                    220: ERRORS
                    221: ------
                    222: 
                    223: Sometimes you may do something which JOVE doesn't allow.  If it is
                    224: something simple, such as typing a control key sequence which is not
                    225: associated with any command, JOVE will just beep at you.  Otherwise,
                    226: JOVE will also display an informative error message at the bottom of
                    227: the screen.
                    228: 
                    229: Some versions of JOVE do not have all the features described in this
                    230: tutorial implemented yet.  If you come across such an unimplemented
                    231: feature, you may get an error message when you try to use it.  Just
                    232: proceed on to the next section of the tutorial.
                    233: 
                    234: 
                    235: INSERTING AND DELETING
                    236: ----------------------
                    237: 
                    238: If you want to type text, just do it.  Characters which you can see,
                    239: such as A, 7, *, etc. are taken by JOVE as text and inserted
                    240: immediately.  Type <Return> (the carriage-return key) to insert a line
                    241: separator.
                    242: 
                    243: You can delete the last character you typed by typing <Delete>.
                    244: <Delete> is a key on the keyboard, which may be labeled "Rubout"
                    245: instead of "Delete" on some terminals.  More generally, <Delete>
                    246: deletes the character immediately before the current cursor position.
                    247: 
                    248: >> Do this now, type a few characters and then delete them by typing
                    249:    <Delete> a few times.  Don't worry about this file being changed;
                    250:    you won't affect the master tutorial.  This is just a copy of it.
                    251: 
                    252: >> Now start typing text until you reach the right margin, and keep
                    253:    typing.  When a line of text gets too big for one line on the
                    254:    screen, the line of text is "continued" off the edge of the screen
                    255:    The exclamation mark at the right margin indicates a line which has
                    256:    been continued.  The line will slide over if you move off the edge
                    257:    on either side.
                    258: 
                    259: >> The following line actually goes off the edge.  Trying typing enough
                    260:    C-F's that you move off the right hand end of this line.... This is a long line of text that the JOVE editor extends to the right.
                    261: 
                    262: >> Use <Delete>s to delete the text until the line fits on one screen
                    263:    line again.  The continuation "!" will go away.
                    264: 
                    265: >> Move the cursor to the beginning of a line and type <Delete>.  This
                    266:    deletes the line separator before the line and merges the line onto
                    267:    the previous line.  The resulting line may be too long to fit, in
                    268:    which case it has a continuation indication.
                    269: 
                    270: >> Type <Return> to insert the separator again.
                    271: 
                    272: Remember that most JOVE commands can be given a repeat count;  Note
                    273: that this includes characters which insert themselves.
                    274: 
                    275: >>  Try that now -- type META 8 * and see what happens.
                    276: 
                    277: If you want to create a blank line in between two lines, move to the
                    278: second of the two lines and type C-O.
                    279: 
                    280: >>  Try moving to a line and typing C-O now.
                    281: 
                    282: You've now learned the most basic way of typing something in JOVE and
                    283: correcting errors.  You can delete by words or lines as well.  Here is
                    284: a summary of the delete operations:
                    285: 
                    286:        <Delete>     delete the character just before the cursor
                    287:        C-D          delete the next character after the cursor
                    288: 
                    289:        M-<Delete>   kill the word immediately before the cursor
                    290:        M-D          kill the next word after the cursor
                    291: 
                    292:        C-K          kill from the cursor position to end of line
                    293:        M-K          kill to the end of the current sentence
                    294: 
                    295: Notice that <Delete> and C-D vs M-<Delete> and M-D extend the parallel
                    296: started by C-F and M-F (well, <Delete> isn't really a control
                    297: character, but let's not worry about that).  C-K and M-K are like C-E
                    298: and M-E, sort of, in that lines are opposite sentences.
                    299: 
                    300: Now suppose you kill something, and then you decide that you want to
                    301: get it back?  Well, whenever you kill something bigger than a
                    302: character, JOVE saves it for you.  To yank it back, use C-Y.  Note
                    303: that you don't have to be in the same place to do C-Y; This is a good
                    304: way to move text around.  Also note that the difference between
                    305: "Killing" and "Deleting" something is that "Killed" things can be
                    306: yanked back, and "Deleted" things cannot.  Generally, the commands
                    307: that can destroy a lot of text save it, while the ones that attack
                    308: only one character, or nothing but blank lines and spaces, do not save.
                    309: 
                    310: For instance, type C-N a couple times to postion the cursor at some
                    311: line on this screen.
                    312: 
                    313: >> Do this now, move the cursor and kill that line with C-K.
                    314: 
                    315: Note that a single C-K kills the contents of the line, and a second
                    316: C-K kills the line itself, and make all the other lines move up.  If
                    317: you give C-K a repeat count, it kills that many lines AND their
                    318: contents.
                    319: 
                    320: The text that has just disappeared is saved so that you can retrieve
                    321: it.  To retrieve the last killed text and put it where the cursor
                    322: currently is, type C-Y.
                    323: 
                    324: >> Try it; type C-Y to yank the text back.
                    325: 
                    326: Think of C-Y as if you were yanking something back that someone took
                    327: away from you.  Notice that if you do several C-K's in a row the text
                    328: that is killed is all saved together so that one C-Y will yank all of
                    329: the lines.
                    330: 
                    331: >> Do this now, type C-K several times.
                    332: 
                    333: Now to retrieve that killed text:
                    334: 
                    335: >> Type C-Y.  Then move the cursor down a few lines and type C-Y
                    336:    again.  You now see how to copy some text.
                    337: 
                    338: What do you do if you have some text you want to yank back, and then
                    339: you kill something else?  C-Y would yank the more recent kill.  But
                    340: the previous text is not lost.  You can get back to it using the M-Y
                    341: command.  After you have done C-Y to get the most recent kill, typing
                    342: M-Y replaces that yanked text with the previous kill.  Typing M-Y
                    343: again and again brings in earlier and earlier kills.  When you have
                    344: reached the text you are looking for, you can just go away and leave
                    345: it there.  If you M-Y enough times, you come back to the starting
                    346: point (the most recent kill).
                    347: 
                    348: >> Kill a line, move around, kill another line.  Then do C-Y to get
                    349:    back the second killed line.  Then do M-Y and it will be replaced
                    350:    by the first killed line.  Do more M-Y's and see what you get.
                    351:    Keep doing them until the second kill line comes back, and then a
                    352:    few more.  If you like, you can try giving M-Y positive and negative
                    353:    arguments.
                    354: 
                    355: 
                    356: FILES
                    357: -----
                    358: 
                    359: In order to make the text you edit permanent, you must put it in a
                    360: file.  Otherwise, it will go away when your invocation of JOVE goes
                    361: away.  While you are editing a file in JOVE, your changes are actually
                    362: being made to a private "scratch" copy of the file.  However, the
                    363: changes still don't become permanent until you "save" the file.  This
                    364: is so you can have control to avoid leaving a half-changed file around
                    365: when you don't want to.
                    366: 
                    367: If you look near the botton of the screen you will see a line that
                    368: looks like this:
                    369:     JOVE (Text) Buffer: teach-jove "teach-jove" *
                    370: "teach-jove" is the name of the file you are editing.  This is the name
                    371: of your own temporary copy of the text of the JOVE tutorial; the file
                    372: you are now editing.  Whatever file you edit, that file's name will
                    373: appear in that precise spot.
                    374: 
                    375: The commands for finding and saving files are unlike the other
                    376: commands you have learned in that they consist of two characters.
                    377: They both start with the character Control-X.  There is a whole series
                    378: of commands that start with Control-X; many of them have to do with
                    379: files, buffers, and related things, and all of them consist of
                    380: Control-X followed by some other character.  As with M- the character
                    381: interpreted the same regardless of case.
                    382: 
                    383: Another thing about the command for finding a file is that you have to
                    384: say what file name you want.  We say the command "reads an argument
                    385: from the terminal" (in this case, the argument is the name of the
                    386: file).  After you type the command
                    387: 
                    388:        C-X C-F   Find a file
                    389: 
                    390: JOVE will ask you for the file name.  You should end the name with
                    391: the Return key.  After this command, you will see the contents of the
                    392: file in your JOVE.  You can edit the contents.  When you wish to make
                    393: the changes permanent, issue the command
                    394: 
                    395:        C-X C-S   Save the file
                    396: 
                    397: Warning: on many systems JOVE will not be able to process the key C-S.
                    398: In place of C-S, you should type C-\.  It is possible to make C-S work
                    399: but C-\ is guaranteed always to work in place of C-S.
                    400: 
                    401: The old version of the file will be replaced.  When the operation is
                    402: finished, JOVE prints the name and number of lines and characters
                    403: saved.
                    404: 
                    405: If you forget to save and then edit a different file, JOVE will remind
                    406: you that you made changes that have not been saved and then ask you
                    407: whether you really want to quit.  (If you don't save them, they will
                    408: be thrown away.  That might be what you want!)  You should answer with
                    409: a "Y" to throw the changes away or "N" to abort quitting so you can
                    410: then save the changes.
                    411: 
                    412: To make a new file, just edit it "as if" it already existed.  Then
                    413: start typing in the text.  When you ask to "save" the file, JOVE will
                    414: really create the file with the text that you have inserted.  From
                    415: then on, you can consider yourself to be editing an already existing
                    416: file.
                    417: 
                    418: It is not easy for you to try out editing a file and continue with the
                    419: tutorial.  But you can always come back into the tutorial by starting
                    420: it over and skipping forward.  So, when you feel ready, you should try
                    421: editing a file named "FOO", putting some text in it, and saving it;
                    422: then exit from JOVE and look at the file to be sure that it worked.
                    423: 
                    424: CONCLUSION OF PART ONE
                    425: ----------------------
                    426:    This is the end of the first part of  this  tutorial.   You  now  know
                    427: enough to edit a file with JOVE, and save your work.  The second part of
                    428: this tutorial, which starts with the next section,  discusses  searching,
                    429: replacing,  word  processing,  and other modes of JOVE.  You may wish to
                    430: stop here and practice for awhile before you continue.
                    431: 
                    432: 
                    433: EXTENDING THE COMMAND SET
                    434: -------------------------
                    435: 
                    436: There are many, many more JOVE commands than could possibly be put on
                    437: all the control and meta characters.  JOVE gets around this with the X
                    438: (eXtend) command.  This comes in two flavors:
                    439: 
                    440:        C-X     Character eXtend.  Followed by one character.
                    441:        M-X     Named command eXtend.  Followed by a long name.
                    442: 
                    443: These are commands that are generally useful but used less than the
                    444: commands you have already learned about.  You have already seen two of
                    445: them: the file commands C-X C-F to Find and C-X C-S to Save.  Another
                    446: example is the command to tell JOVE that you'd like to stop editing.
                    447: The command to do this is C-X C-C.
                    448: 
                    449: There are many C-X commands.  The ones you need immediately are:
                    450: 
                    451:        C-X C-V         Visit file.
                    452:        C-X C-S         Save file.
                    453:        C-X C-C         Quit JOVE.  This does not save your files auto-
                    454:                        matically, though if your files have been modi-
                    455:                        fied, JOVE asks if you really want to quit.  The
                    456:                        standard way to save and exit is C-X C-S C-X C-C.
                    457: 
                    458: Named eXtended commands are commands which are used even less
                    459: frequently, or commands which are used only in certain modes.  These
                    460: commands are usually called "commands".  An example is the command
                    461: "apropos", which prompts for a keyword and then gives the names of all
                    462: the commands that apropos for that keyword.  When you type M-X, JOVE
                    463: prompts you at the bottom of the screen with ":" and you should type
                    464: the name of the command you wish to call; in this case, "apropos".
                    465: Just type "apr<Space>" and JOVE will complete the name.  JOVE will ask
                    466: you for a keyword or phrase and you type the string that you want ask
                    467: about.
                    468: 
                    469: >> Try typing M-X, followed by "apropos" or "apr" and then Return.
                    470:    Then try typing "file" followed by a Return.
                    471: 
                    472: 
                    473: MODE LINE
                    474: ---------
                    475: 
                    476: If JOVE sees that you are typing commands slowly it shows them to you
                    477: at the bottom of the screen in an area called the echo area.  The echo
                    478: area contains the bottom line of the screen.  The line immediately above
                    479: them is called the MODE LINE.  The mode line says something like
                    480: 
                    481:    JOVE (Text)  Buffer: [buffername]  "filename" *
                    482: 
                    483: This is a very useful "information" line.
                    484: 
                    485: The buffername is the name JOVE gave to the buffer, and it is usually
                    486: related to the filename.  You already know what the filename means --
                    487: it is the file you have edited.
                    488: 
                    489: The star means that you have made changes to the text.  Right after
                    490: you visit or save a file, there is no star.
                    491: 
                    492: The part of the mode line inside the parentheses is to tell you what
                    493: modes you are in.  The default mode is Text which is what you are in
                    494: now.  It is an example of a "major mode".  There are several major
                    495: modes in JOVE for editing different languages and text, such as C
                    496: mode, Lisp mode, Text mode, etc.  At any time one and only one major
                    497: mode is active, and its two-letter code can always be found in the
                    498: mode line just where "Text" is now.  Each major mode makes a few
                    499: commands behave differently.  For example, what JOVE considers as part
                    500: of a valid expression or an identifier differs from one major mode to
                    501: another, since each programming language has a different idea of what
                    502: is a legal identifier.
                    503: 
                    504: Major modes are called major because there are also minor modes.  They
                    505: are called minor because they aren't alternatives to the major modes,
                    506: just minor modifications of them.  Each minor mode can be turned on or
                    507: off by itself, regardless of what major mode you are in, and
                    508: regardless of the other minor modes.  So you can use no minor modes,
                    509: or one minor mode, or any combination of several minor modes.
                    510: 
                    511: One minor mode which is very useful, especially for editing English
                    512: text, is "Auto Fill" mode.  When this mode is on, JOVE breaks the line
                    513: in between words automatically whenever the line gets too long.  You
                    514: can turn this mode on by doing M-X auto-fill-mode<Return>.  When the
                    515: mode is on, you can turn it off by doing M-X auto-fill-mode<Return>--
                    516: it toggles.
                    517: 
                    518: >> Type "M-X auto-fill-mode<Return>" now.  Then insert a line with a
                    519:    bunch of words over again until you see it divide into two lines.
                    520:    You must put in spaces between them because Auto Fill breaks lines
                    521:    only at spaces.  Notice that "Fill" (the code for Auto Fill) appears
                    522:    in the mode line after "Text" to indicate that you are in Text Fill
                    523:    mode.
                    524: 
                    525: The margin is usually set at 78 characters, but you can change it with
                    526: the set command.  The margin is kept in a variable just like the mode
                    527: values.
                    528: 
                    529: >> Type "M-X set right-margin 20", then type in some text and see
                    530:    JOVE fill lines of 20 characters with it.  Then set the margin
                    531:    back to 72 using M-X set again.
                    532: 
                    533: 
                    534: SEARCHING
                    535: ---------
                    536: 
                    537: JOVE can do searches for strings (these are groups of contiguous
                    538: characters or words) either forward through the file or backward
                    539: through it.  To search for the string means that you are trying to
                    540: find that string somewhere in the file.  Remember to use C-\ where it
                    541: says C-S.
                    542: 
                    543: >> Now type C-S to start a search.  Type the word 'cursor', then
                    544:    Return.
                    545: 
                    546: >> Type C-S Return to find the next occurrence of "cursor".
                    547: 
                    548: The C-S starts a search that looks for any occurrence of the search
                    549: string AFTER the current cursor position.  But what if you want to
                    550: search for something earlier in the text?  To do this one should type
                    551: C-R for reverse search.  Everything that applies to C-S applies to C-R
                    552: except that the direction of the search is reversed.
                    553: 
                    554: 
                    555: REPLACING TEXT
                    556: --------------
                    557: 
                    558: >> Move the cursor to the blank line two lines below this one.
                    559:    Then type M-r changed<Return>altered<Return>.
                    560: 
                    561:    Notice how this line has changed: you've replaced the word
                    562:    c-h-a-n-g-e-d with "altered" wherever it occurs after the cursor.
                    563: 
                    564: The more customary command for replacing strings is the interactive
                    565: command query-replace-search, which has several options.  In essence,
                    566: it shows each occurrence of the first string and asks you if you want to
                    567: replace it or not.  You can also choose to edit around the string, or
                    568: go on and replace all occurrences without asking further.
                    569: 
                    570:    This is invoked with M-Q..  When you start up a Query Replace, it
                    571: will prompt you with "From" and "To", for what you want to change, and
                    572: what you want to change it to.  JOVE will then move to the first
                    573: occurence of the "From", and wait for a character.  You can type:
                    574: 
                    575:        <SPACE>         Do  the  replacement, and move to next occurrence
                    576:                        of the "From" string.
                    577:        <DEL>           Skip  the  current  "From" string and move to the 
                    578:                        next one.
                    579:        RETURN          Exit the Query Replace now.
                    580:        r               Recursive Edit
                    581:        p               Replace  all  further  occurences  of  the "From" 
                    582:                        string, without asking. 
                    583: 
                    584: Recursive edit makes it possible to temporarily supend the Q-R-S, let the
                    585: user go off and do something, and then return to the search after the  he
                    586: is done. The command exit-jove (C-X C-C) returns from the recursive-edit.
                    587: 
                    588: GETTING MORE HELP
                    589: -----------------
                    590: 
                    591: In this tutorial we have tried to supply just enough information to
                    592: get you started using JOVE.  There is so much available in JOVE that
                    593: it would be impossible to explain it all here.  However, you may want
                    594: to learn more about JOVE since it has numerous desirable features that
                    595: you don't know about yet.  JOVE has a some internal documentation.
                    596: 
                    597: The most basic HELP feature is the describe-key command which is
                    598: available by typing C-X ? and then a command character. JOVE prints
                    599: one line line on the bottom of the screen tell what command is bound to
                    600: that key.  You can then get further information on that command
                    601: using...
                    602: 
                    603: The describe-command command M-? will prompt for the name of a command
                    604: and print out the section from the manual about that command. When you
                    605: are finished reading it, type a Space or a C-G (quit) to bring your text
                    606: back on the screen.
                    607: 
                    608: >> Type C-X ? Control-P.  The message at the bottom of the screen should
                    609:    be something like "C-P is bound to previous-line".
                    610: 
                    611: Multi-character commands such as C-X C-C and <ESC>V are also allowed
                    612: after C-X ?.
                    613: 
                    614: Now lets get more information about the previous-line command.
                    615: 
                    616: >> Type M-? previous-line.  When you are finished reading the
                    617:    output, type a Space.
                    618: 
                    619: The "name of the command" is important for people who are customizing
                    620: JOVE.  It is what appears in the JOVE CHART as the documentation for
                    621: the command character.
                    622: 
                    623: One other form of help is the "apropos" command.  We have already tried
                    624: using this command in an earlier part of this tutorial, but it should
                    625: be mentioned again here.  Apropos prompts for a word or phrase and
                    626: lists all the commands that contain that string.  If you couldn't
                    627: remember the name of a certain command to read file, you could run the
                    628: apropos command with the keyword "file" and it would list all the
                    629: commands that contain "file".  To run apropos you would type
                    630: 
                    631:        M-X apr<Space>file<Return>
                    632: 
                    633: Finally, the full set of JOVE manuals are in five parts, and reside in the
                    634: directory /local/src/jove/doc under the names jove.1 to jove.5.  These
                    635: are in TROFF form and can be formatted into a form readable on the terminal
                    636: or line-printer with the commands:
                    637: 
                    638:        cd /local/src/jove/doc
                    639:        nroff -ms cmds.doc.nr jove.[1-5]
                    640: 
                    641: Besides, someone around you must have a printed version which you can
                    642: borrow! (There's also a copy on the Berkeley Unix 4.3 manuals - in the User
                    643: Supplementary Documents manual (the one with the green spine). There is also
                    644: a chart of JOVE commands, sorted by function, which is handy as a quick
                    645: reference. Ask your local Jove guru for a copy.
                    646: 
                    647: CONCLUSION OF PART TWO
                    648: ----------------------
                    649:    This concludes section two of the JOVE tutorial.  The  rest  of  this
                    650: tutorial  describes  some of the very advanced features of JOVE, such as
                    651: editing more than one file at once, writing your own macros, windows, and
                    652: initialization  files.   Unless  you're  already  somewhat  familiar with
                    653: JOVE, you should probably wait a little while before starting the  third
                    654: section.
                    655: 
                    656: MARKS AND REGIONS
                    657: -----------------
                    658: 
                    659:    In  general, a command which processes an arbitrary part of the buffer
                    660: must know where to start and where to  stop.   In  JOVE,  such  commands
                    661: usually  operate  on the text between point (where the cursor is now) and
                    662: "the mark".  This range of text is called "the  region".   To  specify  a
                    663: region, you set point to one end of it and mark at the other.  It doesn't
                    664: matter which one is set first chronologically, or which one comes earlier
                    665: in the text.  Here are some commands for setting the mark:
                    666: 
                    667:         C-@         Set the mark where point is.
                    668:         C-<SPACE>   The same.
                    669:         C-X C-X     Interchange mark and point.
                    670: 
                    671:    The  most  common  way  to set the mark is with the C-@ command or the
                    672: C-<SPACE> command.  They set the mark where point is.  Then you can  move
                    673: point away, leaving the mark behind.
                    674: 
                    675:    Since  terminals  have  only  one cursor, there is no way for JOVE to
                    676: show you where the mark is located.  You have  to  remember.   The  usual
                    677: solution  to this problem is to set the mark and then use it soon, before
                    678: you forget where it is.  But you can see  where  the  mark  is  with  the
                    679: command  C-X  C-X which puts the mark where point was and point where the
                    680: mark was.  The extent of the region is  unchanged,  but  the  cursor  and
                    681: point are now at the previous location of the mark.
                    682: 
                    683:    There  are many, many commands which use regions (the area between the
                    684: point and the mark), which we have not  mentioned  here. They can be found
                    685: in the Jove Quick Reference Card.
                    686: 
                    687: BUFFERS
                    688: -------
                    689:    When editing a file, JOVE reads the file  into  a  buffer.   This  is
                    690: where the modifcations are done, and when you save the file with C-X C-S,
                    691: the buffer is actually written out to the file.   JOVE  permits  you  to
                    692: have  up  to 100 buffers, so, in essence, you can edit up to 100 files at
                    693: the same time.
                    694: 
                    695:    If you want to list the buffers you have, use  the  C-X  C-B  command.
                    696: This  will  display  a  list of the buffers, their numbers and names, and
                    697: whether or not they've been modified.
                    698: 
                    699: >>> Do this now, type C-X C-B.  When you're done looking, type a <SPACE>.
                    700: 
                    701:    You probably noticed you only have one buffer, named "Main".   If  you
                    702: were  editing  more  than one file, however, you would have more than one
                    703: buffer.  There are two ways to edit more than one file.  The first is  to
                    704: call JOVE with more than one file on the command line.  For example, the
                    705: command
                    706: 
                    707:                              jove a b c
                    708: 
                    709: would create three buffers (named Main, b, and c),  each  one  containing
                    710: one  file.   The  other  way  is  to use the C-X C-F command (called Find
                    711: File).  This command prompts you for a filename, and then reads that file
                    712: into a new buffer, and puts you into the new buffer.
                    713: 
                    714:    To change buffers, use the C-X B command.  JOVE will prompt you for a
                    715: buffer name, and print a name in parentheses.  If you just hit a carriage
                    716: return without typing a buffer name, you will go to the buffer named in
                    717: parentheses.  Another way to change buffers is to give C-X B a NUMBER.
                    718: This goes to the buffer NUMBER, rather than using the buffer name.
                    719: 
                    720: >>> Get a piece of paper, and write down the  following  commands.   Then
                    721:     run  them, to  get a feel for playing with buffers.  BE SURE TO WRITE 
                    722:     THEM DOWN! We don't want to get you lost!
                    723: 
                    724:                        C-X C-B
                    725:                        <SPACE>
                    726:                        C-X C-F         (type "/etc/motd" to the prompt)
                    727:                        C-X C-B
                    728:                        <SPACE>
                    729:                        C-X B
                    730:                        <RETURN>
                    731: 
                    732:    Well, wasn't that fun?  Now you know how  to  get  another  file  into
                    733: another  buffer,  and then "bounce" back and forth.  A nice feature about
                    734: editing more than one file is that you can transfer text from one file to
                    735: the  other.   Just  kill  it in one file, change buffers, and then put it
                    736: back with C-Y.
                    737: 
                    738: WINDOWS
                    739: -------
                    740:    What you see on your screen is a "window" into the buffer you are 
                    741: editing. JOVE allows you to have more than one window on your screen, and
                    742: you can therefore look into two, or more buffers at once. You can also look at
                    743: different parts of the same file. The command C-X 2 splits your screen into
                    744: two windows, both looking into the same buffer. The command C-X 4 f will
                    745: display a specified file in the other window, C-X 4 b will display a specified
                    746: buffer in the other window, C-X n moves to the next window on the screen,
                    747: while C-X p moves to the previous window.
                    748: 
                    749: >>> Try the command C-X 2, which splits the screen into two windows, and
                    750:     displays the same buffer in both. You'll notice that you are in the new
                    751:     window. Try some commmands in this window, like C-V, or M-V, to move
                    752:     around in the file. Observe that the other window doesn't change its
                    753:     position relative to the buffer. This gives you a way of looking at two
                    754:     parts of the same file. 
                    755: 
                    756: >>> Now try to type some text, or change something. You will see the changes
                    757:     affecting the text in the other window as well. That is because both
                    758:     windows are displaying the same buffer, and therefor the same text. Changes
                    759:     in the contents of the buffer have to affect both windows.
                    760: 
                    761: >>> Let's now try to edit another file in this window. Give the command 
                    762:     C-X C-F and type the name of file as "/etc/motd". You now have two files
                    763:     on your screen at the same time. 
                    764: 
                    765: >>> Type the command M- C-V (Meta followed by C-V) and watch the other window
                    766:     page downward. This is very convenient when doing a variety of tasks, like
                    767:     correcting errors in a file - edit the file, with the list of errors in
                    768:     the other window!
                    769: 
                    770: >>> Finally, let's get back to the main window (with this document) by typing
                    771:     C-X p (or C-X n, since there are only two windows). Expand this window 
                    772:     to fill the entire screen by typing C-X 1. 
                    773: 
                    774: Enjoyable, wasn't it! There are other commands for shrinking and growing
                    775: windows, but one of the most useful when editing text like this is the command
                    776: which invokes JOVE's interactive spelling checker. It's called spell-buffer.
                    777: It runs the UNIX spell(1) command on the buffer, and puts the errors in
                    778: another buffer in another window, and allows you to edit the list to remove
                    779: the words you know are not errors. Then, type C-X C-C, which usually gets you
                    780: out of JOVE but in this case only gets you out of the spell-edit mode. You can
                    781: now go through the remaining spelling errors word-by-word, and you can correct
                    782: them. The commands for this are C-X C-N (for next error) and C-X C-P (for
                    783: previous error.) 
                    784: 
                    785: >>> Try the spell-buffer command now, by going M-X spel <space> and watch.
                    786: Delete a few errors, then type C-X C-C, and do a few C-X C-N's to find some
                    787: errors in this document. We've left a few ! (deliberately, of course!!!)
                    788:     
                    789: 
                    790: MACROS
                    791: ------
                    792:    A "keyboard macro" is a command defined by the user  to  abbreviate  a
                    793: sequence  of  other commands.  If you discover that you are about to type
                    794: C-N C-D forty times, you can define a keyboard macro to do  C-N  C-D  and
                    795: call  it  with  a  repeat  count  of forty.  The commands which deal with
                    796: keyboard macros are:
                    797: 
                    798:         C-X (       Start defining a keyboard macro.
                    799:         C-X )       End the definition of a keyboard macro.
                    800:         C-X E       Execute the most recent keyboard macro.
                    801: 
                    802:    You define a keyboard macro while executing the commands which are the
                    803: definition.   Put  differently, as you are defining a keyboard macro, the
                    804: definition is being executed for the first time.  This way, you  can  see
                    805: what  the  effects of your commands are, so that you don't have to figure
                    806: them out in your head.  When you are  finished,  the  keyboard  macro  is
                    807: defined and also has been, in effect, executed once.  You can then do the
                    808: whole thing over again by invoking the macro.
                    809: 
                    810:    To start defining a keyboard macro, type the C-X ( command.  From then
                    811: on,  your  commands  continue to be executed, but also become part of the
                    812: definition of the macro.  "Def" appears in the mode line to remind you of
                    813: what  is  going  on.  When you are finished, the C-X ) command terminates
                    814: the definition (without becoming part of it!).
                    815: 
                    816:    The macro thus defined can be invoked again with  the  C-X  E  command
                    817: which  may  be  given a repeat count as a numeric argument to execute the
                    818: macro many times.  C-X ) can also be given a repeat count as an argument,
                    819: in  which  case it repeats the macro that many times right after defining
                    820: it, but defining the macro counts as the first repetition  (since  it  is
                    821: executed  as  you define it).  So, giving C-X ) an argument of 2 executes
                    822: the macro immediately one additional time.
                    823: 
                    824:    If  you  want  to  perform  an operation on each line, then either you
                    825: should start by positioning point on the line above the first one  to  be
                    826: processed  and  then begin the macro definition with a C-N, or you should
                    827: start on the proper line and end with a C-N.  Either way,  repeating  the
                    828: macro will operate on successive lines.
                    829: 
                    830: >>> Place the cursor at the top of the screen and then enter the commands
                    831:     below.  Note that after the first  command, "Def" appears in the mode 
                    832:     line.
                    833: 
                    834:                        C-X (
                    835:                        C-A
                    836:                        *****
                    837:                        M-F
                    838:                        M-F
                    839:                        M-F
                    840:                        -----
                    841:                        C-N
                    842:                        C-X )
                    843: 
                    844: >>> Notice that as you typed those  commands in, they were executed.  Now   
                    845:     move  the cursor  down a couple of lines, but keep it near the top of 
                    846:     the  screen.  Type the  command C-U C-X E.  This will  execute your 
                    847:     macro 4 times.
                    848: 
                    849:    Although not described here, it is possible  to both name  your macros,
                    850: and to save and restore them from files.  See the documentation for this.
                    851: 
                    852: INITIALIZATION FILES
                    853: --------------------
                    854:    You can initialize JOVE just the way you like it by putting a file
                    855: named ".joverc" in your home directory.  To see what this file should
                    856: look like, look at the one in the directory /usr/src/local/jove/doc. The
                    857: file system.rc is one such file, the other example is example.rc. It
                    858: should be noted that the commands in this file contain control
                    859: characters, which may make it hard to read.  Use the "cat -v" command
                    860: for this. 
                    861: 
                    862:    To  insert control  characters into  a file with JOVE, you should use 
                    863: the C-Q command.  Type C-Q <X> where <X> is the control character. Note that
                    864: C-Q will not work on some terminals, because it, like C-S, is used for
                    865: suspending and restoring the output to the terminal. In that case, use
                    866: the command M-X quo <space> <X>. 
                    867: 
                    868: INTERACTIVE SHELLS
                    869: ------------------
                    870: 
                    871:    One of JOVE's very powerful features is the ability to start up shells
                    872: within the editor, and then use shell commands within the screen editing 
                    873: environment. To execute a command again, just cursor-up to it, change it if
                    874: you want with all the normal editing keys, and hit RETURN once to bring it
                    875: down to your present command line, and again to execute it. We'll bow out
                    876: here suggesting you consult the manual for hard details, or type M-X shell
                    877: <space> if you are the adventurous type! 
                    878: 
                    879: CONCLUSION
                    880: ----------
                    881: 
                    882: Remember, to exit use C-X C-C.
                    883: 
                    884: This tutorial is meant to be understandable to all new users, so if
                    885: you found something unclear, don't sit and blame yourself - complain to
                    886: one of the people listed at the end of this document!
                    887: 
                    888: You'll probably find that if you use JOVE for a few days you won't
                    889: be able to give it up.  Initially it may give you trouble.  But remember
                    890: that this is the case with any editor, especially one that can do many,
                    891: many things.  And JOVE can do practically everything.
                    892: 
                    893:    Hopefully you have enjoyed this tutorial,  and,  more  importantly,  I
                    894: hope you've learned something.  If you use JOVE for about a week, and be
                    895: patient, you will find that it is more convenient  and  friendly  to  use
                    896: than any other editor you've used. I know. I did.
                    897: 
                    898: ---------------------------------------------------------------------------
                    899: This tutorial was originally written by Richard Stallman for EMACS and
                    900: modified by Doug Kingston and Jonathan Payne for JOVE. The section on windows
                    901: was added at UofT by Mark Moraes. Comments on this document should be sent to
                    902: [email protected], or locally (at UofT), to [email protected].

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.