📄 teach-jove
字号:
The describe-command command M-? will prompt for the name of a commandand print out the section from the manual about that command. When youare finished reading it, type a Space or a C-G (quit) to bring your textback on the screen.>> Type C-X ? Control-P. The message at the bottom of the screen should be something like "C-P is bound to previous-line".Multi-character commands such as C-X C-C and <ESC>V are also allowedafter C-X ?.Now lets get more information about the previous-line command.>> Type M-? previous-line. When you are finished reading the output, type a Space.The "name of the command" is important for people who are customizingJOVE. It is what appears in the JOVE CHART as the documentation forthe command character.One other form of help is the "apropos" command. We have already triedusing this command in an earlier part of this tutorial, but it shouldbe mentioned again here. Apropos prompts for a word or phrase andlists all the commands that contain that string. If you couldn'tremember the name of a certain command to read file, you could run theapropos command with the keyword "file" and it would list all thecommands that contain "file". To run apropos you would type M-X apr<Space>file<Return>Finally, the full set of JOVE manuals are in five parts, and reside in thedirectory /local/src/jove/doc under the names jove.1 to jove.5. Theseare in TROFF form and can be formatted into a form readable on the terminalor line-printer with the commands: cd /local/src/jove/doc nroff -ms cmds.doc.nr jove.[1-5]Besides, someone around you must have a printed version which you canborrow! (There's also a copy on the Berkeley Unix 4.3 manuals - in the UserSupplementary Documents manual (the one with the green spine). There is alsoa chart of JOVE commands, sorted by function, which is handy as a quickreference. Ask your local Jove guru for a copy.CONCLUSION OF PART TWO---------------------- This concludes section two of the JOVE tutorial. The rest of thistutorial describes some of the very advanced features of JOVE, such asediting more than one file at once, writing your own macros, windows, andinitialization files. Unless you're already somewhat familiar withJOVE, you should probably wait a little while before starting the thirdsection.MARKS AND REGIONS----------------- In general, a command which processes an arbitrary part of the buffermust know where to start and where to stop. In JOVE, such commandsusually operate on the text between point (where the cursor is now) and"the mark". This range of text is called "the region". To specify aregion, you set point to one end of it and mark at the other. It doesn'tmatter which one is set first chronologically, or which one comes earlierin the text. Here are some commands for setting the mark: C-@ Set the mark where point is. C-<SPACE> The same. C-X C-X Interchange mark and point. The most common way to set the mark is with the C-@ command or theC-<SPACE> command. They set the mark where point is. Then you can movepoint away, leaving the mark behind. Since terminals have only one cursor, there is no way for JOVE toshow you where the mark is located. You have to remember. The usualsolution to this problem is to set the mark and then use it soon, beforeyou forget where it is. But you can see where the mark is with thecommand C-X C-X which puts the mark where point was and point where themark was. The extent of the region is unchanged, but the cursor andpoint are now at the previous location of the mark. There are many, many commands which use regions (the area between thepoint and the mark), which we have not mentioned here. They can be foundin the Jove Quick Reference Card.BUFFERS------- When editing a file, JOVE reads the file into a buffer. This iswhere the modifcations are done, and when you save the file with C-X C-S,the buffer is actually written out to the file. JOVE permits you tohave up to 100 buffers, so, in essence, you can edit up to 100 files atthe same time. If you want to list the buffers you have, use the C-X C-B command.This will display a list of the buffers, their numbers and names, andwhether or not they've been modified.>>> Do this now, type C-X C-B. When you're done looking, type a <SPACE>. You probably noticed you only have one buffer, named "Main". If youwere editing more than one file, however, you would have more than onebuffer. There are two ways to edit more than one file. The first is tocall JOVE with more than one file on the command line. For example, thecommand jove a b cwould create three buffers (named Main, b, and c), each one containingone file. The other way is to use the C-X C-F command (called FindFile). This command prompts you for a filename, and then reads that fileinto a new buffer, and puts you into the new buffer. To change buffers, use the C-X B command. JOVE will prompt you for abuffer name, and print a name in parentheses. If you just hit a carriagereturn without typing a buffer name, you will go to the buffer named inparentheses. Another way to change buffers is to give C-X B a NUMBER.This goes to the buffer NUMBER, rather than using the buffer name.>>> Get a piece of paper, and write down the following commands. Then run them, to get a feel for playing with buffers. BE SURE TO WRITE THEM DOWN! We don't want to get you lost! C-X C-B <SPACE> C-X C-F (type "/etc/motd" to the prompt) C-X C-B <SPACE> C-X B <RETURN> Well, wasn't that fun? Now you know how to get another file intoanother buffer, and then "bounce" back and forth. A nice feature aboutediting more than one file is that you can transfer text from one file tothe other. Just kill it in one file, change buffers, and then put itback with C-Y.WINDOWS------- What you see on your screen is a "window" into the buffer you are editing. JOVE allows you to have more than one window on your screen, andyou can therefore look into two, or more buffers at once. You can also look atdifferent parts of the same file. The command C-X 2 splits your screen intotwo windows, both looking into the same buffer. The command C-X 4 f willdisplay a specified file in the other window, C-X 4 b will display a specifiedbuffer in the other window, C-X n moves to the next window on the screen,while C-X p moves to the previous window.>>> Try the command C-X 2, which splits the screen into two windows, and displays the same buffer in both. You'll notice that you are in the new window. Try some commmands in this window, like C-V, or M-V, to move around in the file. Observe that the other window doesn't change its position relative to the buffer. This gives you a way of looking at two parts of the same file. >>> Now try to type some text, or change something. You will see the changes affecting the text in the other window as well. That is because both windows are displaying the same buffer, and therefor the same text. Changes in the contents of the buffer have to affect both windows.>>> Let's now try to edit another file in this window. Give the command C-X C-F and type the name of file as "/etc/motd". You now have two files on your screen at the same time. >>> Type the command M- C-V (Meta followed by C-V) and watch the other window page downward. This is very convenient when doing a variety of tasks, like correcting errors in a file - edit the file, with the list of errors in the other window!>>> Finally, let's get back to the main window (with this document) by typing C-X p (or C-X n, since there are only two windows). Expand this window to fill the entire screen by typing C-X 1. Enjoyable, wasn't it! There are other commands for shrinking and growingwindows, but one of the most useful when editing text like this is the commandwhich invokes JOVE's interactive spelling checker. It's called spell-buffer.It runs the UNIX spell(1) command on the buffer, and puts the errors inanother buffer in another window, and allows you to edit the list to removethe words you know are not errors. Then, type C-X C-C, which usually gets youout of JOVE but in this case only gets you out of the spell-edit mode. You cannow go through the remaining spelling errors word-by-word, and you can correctthem. The commands for this are C-X C-N (for next error) and C-X C-P (forprevious error.) >>> Try the spell-buffer command now, by going M-X spel <space> and watch.Delete a few errors, then type C-X C-C, and do a few C-X C-N's to find someerrors in this document. We've left a few ! (deliberately, of course!!!) MACROS------ A "keyboard macro" is a command defined by the user to abbreviate asequence of other commands. If you discover that you are about to typeC-N C-D forty times, you can define a keyboard macro to do C-N C-D andcall it with a repeat count of forty. The commands which deal withkeyboard macros are: C-X ( Start defining a keyboard macro. C-X ) End the definition of a keyboard macro. C-X E Execute the most recent keyboard macro. You define a keyboard macro while executing the commands which are thedefinition. Put differently, as you are defining a keyboard macro, thedefinition is being executed for the first time. This way, you can seewhat the effects of your commands are, so that you don't have to figurethem out in your head. When you are finished, the keyboard macro isdefined and also has been, in effect, executed once. You can then do thewhole thing over again by invoking the macro. To start defining a keyboard macro, type the C-X ( command. From thenon, your commands continue to be executed, but also become part of thedefinition of the macro. "Def" appears in the mode line to remind you ofwhat is going on. When you are finished, the C-X ) command terminatesthe definition (without becoming part of it!). The macro thus defined can be invoked again with the C-X E commandwhich may be given a repeat count as a numeric argument to execute themacro many times. C-X ) can also be given a repeat count as an argument,in which case it repeats the macro that many times right after definingit, but defining the macro counts as the first repetition (since it isexecuted as you define it). So, giving C-X ) an argument of 2 executesthe macro immediately one additional time. If you want to perform an operation on each line, then either youshould start by positioning point on the line above the first one to beprocessed and then begin the macro definition with a C-N, or you shouldstart on the proper line and end with a C-N. Either way, repeating themacro will operate on successive lines.>>> Place the cursor at the top of the screen and then enter the commands below. Note that after the first command, "Def" appears in the mode line. C-X ( C-A ***** M-F M-F M-F ----- C-N C-X )>>> Notice that as you typed those commands in, they were executed. Now move the cursor down a couple of lines, but keep it near the top of the screen. Type the command C-U C-X E. This will execute your macro 4 times. Although not described here, it is possible to both name your macros,and to save and restore them from files. See the documentation for this.INITIALIZATION FILES-------------------- You can initialize JOVE just the way you like it by putting a filenamed ".joverc" in your home directory. To see what this file shouldlook like, look at the one in the directory /usr/src/local/jove/doc. Thefile system.rc is one such file, the other example is example.rc. Itshould be noted that the commands in this file contain controlcharacters, which may make it hard to read. Use the "cat -v" commandfor this. To insert control characters into a file with JOVE, you should use the C-Q command. Type C-Q <X> where <X> is the control character. Note thatC-Q will not work on some terminals, because it, like C-S, is used forsuspending and restoring the output to the terminal. In that case, usethe command M-X quo <space> <X>. INTERACTIVE SHELLS------------------ One of JOVE's very powerful features is the ability to start up shellswithin the editor, and then use shell commands within the screen editing environment. To execute a command again, just cursor-up to it, change it ifyou want with all the normal editing keys, and hit RETURN once to bring itdown to your present command line, and again to execute it. We'll bow outhere suggesting you consult the manual for hard details, or type M-X shell<space> if you are the adventurous type! CONCLUSION----------Remember, to exit use C-X C-C.This tutorial is meant to be understandable to all new users, so ifyou found something unclear, don't sit and blame yourself - complain toone of the people listed at the end of this document!You'll probably find that if you use JOVE for a few days you won'tbe able to give it up. Initially it may give you trouble. But rememberthat this is the case with any editor, especially one that can do many,many things. And JOVE can do practically everything. Hopefully you have enjoyed this tutorial, and, more importantly, Ihope you've learned something. If you use JOVE for about a week, and bepatient, you will find that it is more convenient and friendly to usethan any other editor you've used. I know. I did.---------------------------------------------------------------------------This tutorial was originally written by Richard Stallman for EMACS andmodified by Doug Kingston and Jonathan Payne for JOVE. The section on windowswas added by Mark Moraes. Comments on this document should be sent tojpayne@sun.com or to moraes@csri.toronto.edu.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -