Debian Codegraph @

doc/teach-jove

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