typo in nntp name
[unix-history] / usr / src / contrib / jove-4.14.6 / USD.doc / jove.1
CommitLineData
42410e64
KM
1.\" @(#)jove.1 6.1 (Berkeley) %G%
2.\"
3.\" ditroff -ms
4.de IQ
5\\fI\\$1\\fP
6..
7.de dc
8.NH 2
9\\$1
10.if '\\$2'(variable)' (variable)
11.if !'\\$2'(variable)' (\\$2)
12.LP
13..
14.nr LL 6.5i
15.nr LT 6.5i
16.EH 'USD:17-%''JOVE Manual for UNIX Users'
17.OH 'JOVE Manual for UNIX Users''USD:17-%'
18.LP
19.TL
20JOVE Manual for UNIX Users
21.AU
22Jonathan Payne
23(revised for 4.3BSD by Doug Kingston and Mark Seiden)
24.AI
25.AB no
26.AE
27.NH 1
28Introduction
29.XS \n(PN
30\*(SN Introduction
31.XE
32.LP
33\s-2JOVE\s0*
34.FS
35*\s-2JOVE\s0 stands for Jonathan's Own Version of Emacs.
36.FE
37is an advanced, self-documenting, customizable real-time display editor.
38It (and this tutorial introduction) are based on the original EMACS editor and user
39manual written at M.I.T. by Richard Stallman+.
40.FS
41+Although \s-2JOVE\s0 is meant to be compatible with EMACS,
42and indeed many of the basic commands are very similar,
43there are some major differences between the two editors,
44and you should not rely on their behaving identically.
45.FE
46.LP
47\s-2JOVE\s0 is considered a
48.I display
49editor because normally the text being
50edited is visible on the screen and is updated automatically as you
51type your commands.
52.LP
53It's considered a
54.I real-time
55editor because the display is updated very
56frequently, usually after each character or pair of characters you type.
57This minimizes the amount of information you must keep in your
58head as you edit.
59.LP
60\s-2JOVE\s0 is
61.I advanced
62because it provides facilities that go beyond
63simple insertion and deletion:
64filling of text;
65automatic indentations of programs;
66view more than one file at once;
67and dealing in terms of characters, words, lines, sentences and paragraphs.
68It is much easier
69to type one command meaning "go to the end of the paragraph" than to
70find the desired spot with repetition of simpler commands.
71.LP
72.I Self-documenting
73means that at almost any time you can easily
74find out what a command does,
75or to find all the commands that pertain to a topic.
76.LP
77.I Customizable
78means that you can change the definition of \s-2JOVE\s0 commands
79in little ways.
80For example, you can rearrange the command set;
81if you prefer to use arrow keys for the four basic cursor motion commands
82(up, down, left and right), you can.
83Another sort of customization is
84writing new commands by combining built in commands.
85.NH 1
86The Organization of the Screen
87.XS \n(PN
88\*(SN The Organization of the Screen
89.XE
90.LP
91\s-2JOVE\s0 divides the screen up into several sections.
92The biggest of these sections is used to display the text you are editing.
93The terminal's cursor shows the position of \fIpoint\fP,
94the location at which editing takes place.
95While the cursor appears to point \fIat\fP a character,
96point should be thought of as between characters;
97it points \fIbefore\fP the character that the cursor appears on top of.
98Terminals have only one cursor,
99and when output is in progress it must appear where the typing is being done.
100This doesn't mean that point is moving;
101it is only that \s-2JOVE\s0 has no way of
102showing you the location of point except when the terminal is idle.
103.LP
104The lines of the screen are usually available for displaying text but
105sometimes are pre-empted by typeout from certain commands (such as a
106listing of all the editor commands).
107Most of the time,
108output from commands like these is only desired for a short period of time,
109usually just long enough to glance at it.
110When you have finished looking at the output,
111you can type Space to make your text reappear.
112(Usually a Space that you type inserts itself, but when there is typeout on
113the screen, it does nothing but get rid of that).
114Any other command executes normally,
115.I after
116redrawing your text.
117.NH 2
118The Message Line
119.XS \n(PN 5n
120\*(SN The Message Line
121.XE
122.LP
123The bottom line on the screen, called the
124\fImessage line\fP,
125is reserved for printing messages and for accepting input from the user,
126such as filenames or search strings.
127When
128\s-2JOVE\s0
129prompts for input,
130the cursor will temporarily appear on the bottom line, waiting for you
131to type a string.
132When you have finished typing your input, you can
133type a Return to send it to \s-2JOVE\s0.
134If you change your mind about running the command that is waiting for input,
135you can type Control-G to abort,
136and you can continue with your editing.
137.LP
138When \s-2JOVE\s0 is prompting for a filename,
139all the usual editing facilities can be used to fix typos and such;
140in addition, \s-2JOVE\s0 has the following extra functions:
141.IP "^N"
142Insert the next filename from the argument list.
143.IP "^P"
144Insert the previous filename from the argument list.
145.IP "^R"
146Insert the full pathname of the file in the current buffer.
147.LP
148Sometimes you will see \fB--more--\fP on the message line.
149This happens when typeout from a command is too long to fit in the screen.
150It means that if you type a Space the next screenful of typeout will be
151printed.
152If you are not interested,
153typing anything but a Space will cause the rest of the output to be discarded.
154Typing C-G will discard the output and print \fIAborted\fP where the \fB--more--\fP was.
155Typing any other command will discard the rest of the output and
156also execute the command.
157.LP
158The message line and the list of filenames from the shell command that
159invoked \s-2JOVE\s0 are kept in a special buffer called
160\fIMinibuf\fP that can be edited like any other buffer.
161.NH 2
162The Mode Line
163.XS \n(PN 5n
164\*(SN The Mode Line
165.XE
166.LP
167At the bottom of the screen, but above the message line, is the
168\fImode line\fP. The mode line format looks like this:
169.DS I
170\fBJOVE (major minor) Buffer: bufr "file" *\fP
171.DE
172\fImajor\fP is the name of the current \fImajor mode\fP.
173At any time, \s-2JOVE\s0 can be in only one major mode at a time.
174Currently there are only four major modes: \fIFundamental\fP,
175\fIText\fP, \fILisp\fP and \fIC\fP.
176.LP
177\fIminor\fP is a list of the minor modes that are turned on.
178\fBAbbrev\fP means that \fIWord Abbrev\fP mode is on;
179\fBAI\fP means that \fIAuto Indent\fP mode is on;
180\fBFill\fP means that \fIAuto Fill\fP mode is on;
181\fBOvrWt\fP means that \fIOver Write\fP mode is on.
182\fBDef\fP means that you are in the process of defining a keyboard macro.
183This is not really a mode,
184but it's useful to be reminded about it.
185The meanings of these modes are described later in this document.
186.LP
187\fIbufr\fP is the name of the currently selected \fIbuffer\fP.
188Each buffer has its own name and holds a file being edited;
189this is how \s-2JOVE\s0 can hold several files at once.
190But at any given time you are editing only one of them,
191the \fIselected\fP buffer.
192When we speak of what some command does to "the buffer",
193we are talking about the currently selected buffer.
194Multiple buffers makes it easy to switch around between several files,
195and then it is very useful that
196the mode line tells you which one you are editing at any time. (You
197will see later that it is possible to divide the
198screen into multiple \fIwindows\fP, each showing a different buffer. If you
199do this, there is a mode line beneath each window.)
200.LP
201\fIfile\fP is the name of the file that you are editing.
202This is the default filename for commands that expect a filename as input.
203.LP
204The asterisk at the end of the mode line means that there are changes in
205the buffer that have not been saved in the file.
206If the file has not been changed since it was read in or saved,
207there is no asterisk.
208.NH 1
209Command Input Conventions
210.XS \n(PN
211\*(SN Command Input Conventions
212.XE
213.LP
214.NH 2
215Notational Conventions for ASCII Characters
216.XS \n(PN 5n
217\*(SN Notational Conventions for ASCII Characters
218.XE
219.LP
220In this manual,
221"Control" characters
222(that is, characters that are typed with the Control key
223and some other key at the same time)
224are represented by "C-" followed by another character.
225Thus,
226C-A is the character you get when you type A with the Control key
227(sometimes labeled CTRL) down.
228Most control characters when present in the \s-2JOVE\s0
229buffer are displayed with a caret; thus, ^A for C-A.
230Rubout (or DEL) is displayed as ^?, escape as ^[.
231.NH 2
232Command and Filename Completion
233.XS \n(PN 5n
234\*(SN Command and Filename Completion
235.XE
236.LP
237When you are typing the name of a \s-2JOVE\s0 command, you need type only
238enough letters to make the name unambiguous. At any point in the course of
239typing the name, you can type question mark (?) to see a list of all the
240commands whose names begin with the characters you've already typed; you can
241type Space to have \s-2JOVE\s0 supply as many characters as it can; or you
242can type Return to complete the command if there is only one possibility.
243For example, if you have typed the letters "\fIau\fP" and you then type a
244question mark, you will see the list
245.DS I
246 auto-execute-command
247 auto-execute-macro
248 auto-fill-mode
249 auto-indent-mode
250.DE
251If you type a Return at this point, \s-2JOVE\s0 will complain by ringing
252the bell, because the letters you've typed do not unambiguously specify a
253single command. But if you type Space, \s-2JOVE\s0 will supply the
254characters "\fIto-\fP" because all commands that begin "\fIau\fP" also
255begin "\fIauto-\fP". You could then type the letter "\fIf\fP" followed
256by either Space or Return, and \s-2JOVE\s0 would complete the entire
257command.
258.LP
259Whenever \s-2JOVE\s0 is prompting you for a filename,
260say in the \fIfind-file\fP command,
261you also need only type enough of the name to make it unambiguous with
262respect to files that already exist. In this case, question mark and
263Space work just as they do in command completion, but Return always
264accepts the name just as you've typed it, because you might want to
265create a new file with a name similar to that of an existing file.
266.NH 1
267Commands and Variables
268.XS \n(PN
269\*(SN Commands and Variables
270.XE
271.LP
272\s-2JOVE\s0 is composed of \fIcommands\fP
273which have long names such as
274\fInext-line\fP.
275Then \fIkeys\fP such as C-N are connected to
276commands through the \fIcommand dispatch table\fP.
277When we say that C-N moves the cursor down a line,
278we are glossing over a distinction which is unimportant for ordinary use,
279but essential for simple customization:
280it is the command \fInext-line\fP which knows how to move a down line,
281and C-N moves down a line because it is connected to that command.
282The name for this connection is a \fIbinding\fP; we say that the key
283C-N \fIis bound to\fP the command \fInext-line\fP.
284.LP
285Not all commands are bound to keys. To invoke a command that isn't bound
286to a key, you can type the sequence ESC X, which is bound to the command
287\fIexecute-named-command\fP. You will then be able to type the name of
288whatever command you want to execute on the message line.
289.LP
290Sometimes the description of a command will say
291"to change this, set the variable \fImumble\-foo\fP".
292A variable is a name used to remember a value.
293\s-2JOVE\s0 contains variables which are there so that you can change
294them if you want to customize.
295The variable's value is examined by some command,
296and changing that value makes the command behave differently.
297Until you are interesting in customizing \s-2JOVE\s0,
298you can ignore this information.
299.NH 2
300Prefix Characters
301.XS \n(PN 5n
302\*(SN Prefix Characters
303.XE
304.LP
305Because there are more command names than keys,
306\s-2JOVE\s0 provides
307\fIprefix characters\fP to increase the number of commands that can
308be invoked quickly and easily.
309When you type a prefix character \s-2JOVE\s0 will wait
310for another character before deciding what to do.
311If you wait more than a second or so,
312\s-2JOVE\s0 will print the prefix character on the
313message line as a reminder and leave the cursor down there until you type your next
314character.
315There are two prefix characters built into \s-2JOVE\s0:
316Escape and Control-X.
317How the next character is interpreted depends on which
318prefix character you typed.
319For example,
320if you type Escape followed by B you'll run \fIbackward-word\fP,
321but if you type Control-X followed by B you'll run \fIselect-buffer\fP.
322Elsewhere in this manual, the Escape key is indicated as "ESC", which is
323also what \s-2JOVE\s0 displays on the message line for Escape.
324.NH 2
325Help
326.XS \n(PN
327\*(SN Help
328.XE
329.LP
330To get a list of keys and their associated commands,
331you type ESC X \fIdescribe-bindings\fP.
332If you want to describe a single key,
333ESC X \fIdescribe-key\fP will work. A description of an
334individual command is available by using ESC X \fIdescribe-command\fP,
335and descriptions of variables by using ESC X \fIdescribe-variable\fP.
336If you can't remember the name of the thing you want to know about,
337ESC X \fIapropos\fP will tell you if a command or variable has a given
338string in its name. For example, ESC X \fIapropos describe\fP will
339list the names of the four describe commands mentioned briefly in this
340section.
341.NH 1
342Basic Editing Commands
343.XS \n(PN
344\*(SN Basic Editing Commands
345.XE
346.LP
347.NH 2
348Inserting Text
349.XS \n(PN 5n
350\*(SN Inserting Text
351.XE
352.LP
353To insert printing characters into the text you are editing,
354just type them.
355All printing characters you type are inserted into the text at
356the cursor (that is, at \fIpoint\fP),
357and the cursor moves forward.
358Any characters after the cursor move forward too.
359If the text in the buffer is FOOBAR,
360with the cursor before the B,
361then if you type XX,
362you get FOOXXBAR,
363with the cursor still before the B.
364.LP
365To correct text you have just inserted,
366you can use Rubout.
367Rubout deletes the character \fIbefore\fP the cursor (not the one that the
368cursor is on top of or under; that is the character \fIafter\fP the
369cursor).
370The cursor and all characters after it move backwards.
371Therefore,
372if you typing a printing character and then type Rubout,
373they cancel out.
374.LP
375To end a line and start typing a new one,
376type Return.
377Return operates by inserting a \fIline-separator\fP,
378so if you type Return in
379the middle of a line,
380you break the line in two.
381Because a line-separator is just a single character,
382you can type Rubout at the
383beginning of a line to delete the line-separator and join it with the
384preceding line.
385.LP
386As a special case, if you type Return at the end of a line and there are
387two or more empty lines just below it, \s-2JOVE\s0 does not insert a
388line-separator but instead merely moves to the next (empty) line. This
389behavior is convenient when you want to add several lines of text in the
390middle of a buffer. You can use the Control-O (\fInewline-and-backup\fP)
391command to "open" several empty lines at once; then you can insert the new
392text, filling up these empty lines. The advantage is that \s-2JOVE\s0 does
393not have to redraw the bottom part of the screen for each Return you type,
394as it would ordinarily. That "redisplay" can be both slow and distracting.
395.LP
396If you add too many characters to one line,
397without breaking it with Return,
398the line will grow too long to display on one screen line.
399When this happens,
400\s-2JOVE\s0 puts an "!" at the extreme right margin,
401and doesn't bother to display the rest of the line unless the
402cursor happens to be in it.
403The "!" is not part of your text;
404conversely,
405even though you can't see the rest of your line,
406it's still there,
407and if you break the line,
408the "!" will go away.
409.LP
410Direct insertion works for printing characters and space,
411but other
412characters act as editing commands and do not insert themselves.
413If you need to insert a control character,
414Escape,
415or Rubout,
416you must first \fIquote\fP it by typing the Control-Q command first.
417.NH 2
418Moving the Cursor
419.XS \n(PN 5n
420\*(SN Moving the Cursor
421.XE
422.LP
423To do more than insert characters,
424you have to know how to move the cursor.
425Here are a few of the commands for doing that.
426.IP "C-A" 15n
427Move to the beginning of the line.
428.IP "C-E" 15n
429Move to the end of the line.
430.IP "C-F" 15n
431Move forward over one character.
432.IP "C-B" 15n
433Move backward over one character.
434.IP "C-N" 15n
435Move down one line,
436vertically.
437If you start in the middle of one line,
438you end in the middle of the next.
439.IP "C-P" 15n
440Move up one line,
441vertically.
442.IP "ESC <" 15n
443Move to the beginning of the entire buffer.
444.IP "ESC >" 15n
445Move to the end of the entire buffer.
446.IP "ESC ," 15n
447Move to the beginning of the visible window.
448.IP "ESC ." 15n
449Move to the end of the visible window.
450.NH 2
451Erasing Text
452.XS \n(PN 5n
453\*(SN Erasing Text
454.XE
455.LP
456.IP "Rubout" 15n
457Delete the character before the cursor.
458.IP "C-D" 15n
459Delete the character after the cursor.
460.IP "C-K" 15n
461Kill to the end of the line.
462.LP
463You already know about the Rubout command which deletes the character
464before the cursor.
465Another command,
466Control-D,
467deletes the character
468after the cursor,
469causing the rest of the text on the line to shift left.
470If Control-D is typed at the end of a line,
471that line and the next line are joined together.
472.LP
473To erase a larger amount of text,
474use the Control-K command,
475which kills a line at a time.
476If Control-K is done at the beginning or
477middle of a line,
478it kills all the text up to the end of the line.
479If Control-K is done at the end of a line,
480it joins that line and the next line.
481If Control-K is done twice, it kills the rest of the line and the line
482separator also.
483.NH 2
484Files \(em Saving Your Work
485.XS \n(PN 5n
486\*(SN Files \(em Saving Your Work
487.XE
488.LP
489The commands above are sufficient for creating text in the \s-2JOVE\s0 buffer.
490The more advanced \s-2JOVE\s0 commands just make things easier.
491But to keep any text permanently you must put it in a \fIfile\fP.
492Files are the objects which
493.UX
494uses for storing data for a length of time.
495To tell \s-2JOVE\s0 to read text into a file,
496choose a filename,
497such as \fIfoo.bar\fP,
498and type C-X C-R \fIfoo.bar\fP<return>.
499This reads the file \fIfoo.bar\fP so that its contents appear on the screen
500for editing.
501You can make changes,
502and then save the file by typing C-X C-S (save-file).
503This makes the changes permanent and actually changes the file \fIfoo.bar\fP.
504Until then,
505the changes are only inside \s-2JOVE\s0,
506and the file \fIfoo.bar\fP is not really changed.
507If the file \fIfoo.bar\fP doesn't exist,
508and you want to create it,
509read it as if it did exist.
510When you save your text with C-X C-S the file will be created.
511.NH 2
512Exiting and Pausing \(em Leaving \s-2JOVE\s0
513.XS \n(PN 5n
514\*(SN Exiting and Pausing \(em Leaving \s-2JOVE\s0
515.XE
516.LP
517The command C-X C-C (\fIexit-jove\fP) will terminate the \s-2JOVE\s0
518session and return to the shell. If there are modified but
519unsaved buffers, \s-2JOVE\s0 will ask you for confirmation, and you
520can abort the command, look at what buffers are
521modified but unsaved using C-X C-B (\fIlist-buffers\fP), save the
522valuable ones, and then exit. If what you want to do, on the other hand,
523is \fIpreserve\fP the editing session but return to the shell temporarily
524you can (under Berkeley
525.UX
526only) issue the command ESC S (\fIpause-jove\fP), do your
527.UX
528work within the c-shell, then return to \s-2JOVE\s0 using the
529\fIfg\fP command to resume editing at the point where you paused.
530For this sort of situation you might consider using an \fIinteractive
531shell\fP (that is, a shell in a \s-2JOVE\s0 window) which lets you use
532editor commands to manipulate your
533.UX
534commands (and their output) while never leaving the editor.
535(The interactive shell feature is described below.)
536.NH 2
537Giving Numeric Arguments to \s-2JOVE\s0 Commands
538.XS \n(PN 5n
539\*(SN Giving Numeric Arguments to \s-2JOVE\s0 Commands
540.XE
541.LP
542Any \s-2JOVE\s0 command can be given a \fInumeric argument\fP.
543Some commands interpret the argument as a repetition count.
544For example,
545giving an argument of ten to the C-F command (forward-character) moves forward
546ten characters.
547With these commands,
548no argument is equivalent to an argument of 1.
549.LP
550Some commands use the value of the argument,
551but do something peculiar (or nothing) when there is no argument.
552For example,
553ESC G (\fIgoto-line\fP) with an argument \fBn\fP
554goes to the beginning of the \fBn\fP'th line.
555But ESC G with no argument doesn't do anything.
556Similarly, C-K with an argument kills that many lines, including their line
557separators. Without an argument, C-K when there is text on the line to the
558right of
559the cursor kills that text; when there is no text after the cursor, C-K
560deletes the line separator.
561.LP
562The fundamental way of specifying an argument is to use ESC followed
563by the digits of the argument, for example, ESC 123 ESC G to go to line
564123. Negative arguments are allowed,
565although not all of the commands know what to do with one.
566.LP
567Typing C-U means do the next command four times.
568Two such C-U's multiply the next command by sixteen.
569Thus,
570C-U C-U C-F moves forward sixteen characters.
571This is a good way to move forward quickly,
572since it moves about 1/4 of a line on most terminals.
573Other useful combinations are:
574C-U C-U C-N (move down a good fraction of the screen),
575C-U C-U C-O (make "a lot" of blank lines),
576and C-U C-K (kill four lines \(em note that typing C-K four times
577would kill 2 lines).
578.LP
579There are other,
580terminal-dependent ways of specifying arguments.
581They have the same effect but may be easier to type.
582If your terminal
583has a numeric keypad which sends something recognizably different from
584the ordinary digits,
585it is possible to program \s-2JOVE\s0 to to allow use of
586the numeric keypad for specifying arguments.
587.NH 2
588The Mark and the Region
589.XS \n(PN 5n
590\*(SN The Mark and the Region
591.XE
592.LP
593In general,
594a command that processes an arbitrary part of the buffer
595must know where to start and where to stop.
596In \s-2JOVE\s0,
597such commands usually operate on the text between point and \fIthe mark\fP.
598This body of text is called \fIthe region\fP.
599To specify a region,
600you set point to one end of it and mark at the other.
601It doesn't matter which one comes earlier in the text.
602.IP "C-@" 15n
603Set the mark where point is.
604.IP "C-X C-X" 15n
605Interchange mark and point.
606.LP
607For example,
608if you wish to convert part of the buffer to all upper-case,
609you can use the C-X C-U command,
610which operates on the text in the region.
611You can first go to the beginning of the text to be capitalized,
612put the mark there, move to the end, and then type C-X C-U.
613Or,
614you can set the mark at the end of the text,
615move to the beginning,
616and then type C-X C-U.
617C-X C-U runs the command \fIcase-region-upper\fP,
618whose name signifies that the region,
619or everything between point and mark,
620is to be capitalized.
621.LP
622The way to set the mark is with the C-@ command or (on some
623terminals) the C-Space command.
624They set the mark where point is.
625Then you can move point away,
626leaving mark behind. When the mark is set, "[Point pushed]" is printed on
627the message line.
628.LP
629Since terminals have only one cursor,
630there is no way for \s-2JOVE\s0 to show you where the mark is located.
631You have to remember.
632The usual solution to this problem is to set the mark and then use it soon,
633before you forget where it is.
634But you can see where the mark is with
635the command C-X C-X which puts the mark where point was and point
636where mark was.
637The extent of the region is unchanged,
638but the cursor and point are now at the previous location of the mark.
639.NH 2
640The Ring of Marks
641.XS \n(PN 5n
642\*(SN The Ring of Marks
643.XE
644.LP
645Aside from delimiting the region,
646the mark is also useful for remembering a spot that you may want to go back to.
647To make this feature more useful,
648\s-2JOVE\s0 remembers 16 previous locations of the mark.
649Most commands that set the mark push the old mark onto this stack.
650To return to a marked location, use C-U C-@.
651This moves point to where the mark was,
652and restores the mark from the stack of former marks.
653So repeated use of this command moves point to all of the old
654marks on the stack,
655one by one.
656Since the stack is actually a ring,
657enough uses of C-U C-@ bring point back to where it was originally.
658.LP
659Some commands whose primary purpose is to move point a great distance
660take advantage of the stack of marks to give you a way to undo the
661command.
662The best example is ESC <,
663which moves to the beginning of the buffer.
664If there are more than 22 lines between the beginning of
665the buffer and point,
666ESC < sets the mark first,
667so that you can use C-U C-@ or C-X C-X to go back to where you were.
668You can change the number of lines from 22 since it is kept in the variable \fImark-threshold\fP.
669By setting it to 0,
670you can make these commands always set the mark.
671By setting it to a very large number you can prevent these commands from ever
672setting the mark.
673If a command decides to set the mark,
674it prints the message \fI[Point pushed]\fP.
675.NH 2
676Killing and Moving Text
677.XS \n(PN 5n
678\*(SN Killing and Moving Text
679.XE
680.LP
681The most common way of moving or copying text with \s-2JOVE\s0 is to kill it,
682and get it back again in one or more places.
683This is very safe
684because the last several pieces of killed text are all remembered,
685and it is versatile,
686because the many commands for killing syntactic units
687can also be used for moving those units.
688There are also other ways of moving text for special purposes.
689.NH 2
690Deletion and Killing
691.XS \n(PN 5n
692\*(SN Deletion and Killing
693.XE
694.LP
695Most commands which erase text from the buffer save it so that you can
696get it back if you change your mind,
697or move or copy it to other parts of the buffer.
698These commands are known as \fIkill\fP commands.
699The rest of the commands that erase text do not save it;
700they are known as \fIdelete\fP commands.
701The delete commands include C-D and Rubout,
702which delete only one character at a time,
703and those commands that delete only spaces or line separators.
704Commands that can destroy significant amounts of nontrivial data generally kill.
705A command's
706name and description will use the words \fIkill\fP or \fIdelete\fP to
707say which one it does.
708.IP "C-D" 20n
709Delete next character.
710.IP "Rubout" 20n
711Delete previous character.
712.IP "ESC \\\\\\\\" 20n
713Delete spaces and tabs around point.
714.IP "C-X C-O" 20n
715Delete blank lines around the current line.
716.IP "C-K" 20n
717Kill rest of line or one or more lines.
718.IP "C-W" 20n
719Kill region (from point to the mark).
720.IP "ESC D" 20n
721Kill word.
722.IP "ESC Rubout" 20n
723Kill word backwards.
724.IP "ESC K" 20n
725Kill to end of sentence.
726.IP "C-X Rubout" 20n
727Kill to beginning of sentence.
728.NH 2
729Deletion
730.XS \n(PN 5n
731\*(SN Deletion
732.XE
733.LP
734The most basic delete commands are C-D and Rubout.
735C-D deletes the character after the cursor,
736the one the cursor is "on top of" or "underneath".
737The cursor doesn't move.
738Rubout deletes the character before the cursor,
739and moves the cursor back.
740Line separators act like normal characters when deleted.
741Actually,
742C-D and Rubout aren't always \fIdelete\fP commands;
743if you give an argument,
744they \fIkill\fP instead.
745This prevents you from losing a great deal of text by typing a large
746argument to a C-D or Rubout.
747.LP
748The other delete commands are those which delete only formatting
749characters:
750spaces,
751tabs,
752and line separators.
753ESC \\ (\fIdelete-white-space\fP)
754deletes all the spaces and tab characters before and after point.
755C-X C-O (\fIdelete-blank-lines\fP) deletes all blank lines after the current line,
756and if the current line is blank deletes all the blank
757lines preceding the current line as well
758(leaving one blank line, the current line).
759.NH 2
760Killing by Lines
761.XS \n(PN 5n
762\*(SN Killing by Lines
763.XE
764.LP
765The simplest kill command is the C-K command.
766If issued at the beginning of a line,
767it kills all the text on the line,
768leaving it blank.
769If given on a line containing only white space (blanks and tabs)
770the line disappears.
771As a consequence,
772if you go to the front of a non-blank line and type two C-K's,
773the line disappears completely.
774.LP
775More generally,
776C-K kills from point up to the end of the line,
777unless it is at the end of a line.
778In that case,
779it kills the line separator following the line,
780thus merging the next line into the current one.
781Invisible spaces and tabs at the end of the line are ignored when
782deciding which case applies,
783so if point appears to be at the end of the line,
784you can be sure the line separator will be killed.
785.LP
786C-K with an argument of zero kills all the text before
787point on the current line.
788.NH 2
789Other Kill Commands
790.XS \n(PN 5n
791\*(SN Other Kill Commands
792.XE
793.LP
794A kill command which is very general is C-W (\fIkill-region\fP),
795which kills everything between point and the mark.*
796.FS
797*Often users switch this binding from C-W to C-X C-K because it is too
798easy to hit C-W accidentally.
799.FE
800With this command,
801you can kill and save contiguous characters,
802if you first set the mark at one end of them and go to the other end.
803.LP
804Other syntactic units can be killed, too;
805words,
806with ESC Rubout and ESC D;
807and, sentences,
808with ESC K and C-X Rubout.
809.NH 2
810Un-killing
811.XS \n(PN 5n
812\*(SN Un-killing (Yanking)
813.XE
814.LP
815Un-killing (yanking) is getting back text which was killed.
816The usual way to
817move or copy text is to kill it and then un-kill it one or more times.
818.IP "C-Y" 10n
819Yank (re-insert) last killed text.
820.IP "ESC Y" 10n
821Replace re-inserted killed text with the previously killed text.
822.IP "ESC W" 10n
823Save region as last killed text without killing.
824.LP
825Killed text is pushed onto a \fIring buffer\fP called the \fIkill
826ring\fP that remembers the last 10 blocks of text that were killed.
827(Why it is called a ring buffer will be explained below).
828The command C-Y (\fIyank\fP) reinserts the text of the most recent kill.
829It leaves the cursor at the end of the text,
830and puts the mark at the beginning.
831Thus,
832a single C-Y undoes the C-W.
833.LP
834If you wish to copy a block of text,
835you might want to use ESC W (\fIcopy-region\fP),
836which copies the region into the kill ring without removing it from the buffer.
837This is approximately equivalent to C-W followed by C-Y,
838except that ESC W does not mark the buffer as
839"changed" and does not cause the screen to be rewritten.
840.LP
841There is only one kill ring shared among all the buffers.
842After visiting a new file,
843whatever was last killed in the previous file is still on top of the kill ring.
844This is important for moving text between files.
845.NH 2
846Appending Kills
847.XS \n(PN 5n
848\*(SN Appending Kills
849.XE
850.LP
851Normally,
852each kill command pushes a new block onto the kill ring.
853However,
854two or more kill commands immediately in a row (without any other
855intervening commands) combine their text into a
856single entry on the ring,
857so that a single C-Y command gets it all back as it was before it was killed.
858This means that you don't have to kill all the text in one command;
859you can keep killing line after line,
860or word after word,
861until you have killed it all,
862and you can still get it all back at once.
863.LP
864Commands that kill forward from
865.I point
866add onto the end of the previous
867killed text.
868Commands that kill backward from
869.I point
870add onto the beginning.
871This way,
872any sequence of mixed forward and backward kill
873commands puts all the killed text into one entry without needing rearrangement.
874.NH 2
875Un-killing Earlier Kills
876.XS \n(PN 5n
877\*(SN Un-killing Earlier Kills
878.XE
879.LP
880To recover killed text that is no longer the most recent kill,
881you need the ESC Y (\fIyank-pop\fP) command.
882The ESC Y command can be used
883only after a C-Y (yank) command or another ESC Y.
884It takes the un-killed
885text inserted by the C-Y and replaces it with the text from an earlier
886kill.
887So,
888to recover the text of the next-to-the-last kill,
889you first use C-Y to recover the last kill,
890and then discard it by use of ESC Y to move back to the previous kill.
891.LP
892You can think of all the last few kills as living on a ring.
893After a C-Y command,
894the text at the front of the ring is also present in the buffer.
895ESC Y "rotates" the ring bringing the previous string of text to the front
896and this text replaces the other text in the buffer as well.
897Enough ESC Y commands can rotate any part of the ring to the front,
898so you can get at any killed text so long as it is recent enough
899to be still in the ring.
900Eventually the ring rotates all the way
901around and the most recently killed text comes to the front
902(and into the buffer) again.
903ESC Y with a negative argument rotates the ring backwards.
904.LP
905When the text you are looking for is brought into the buffer,
906you can stop doing ESC Y's and the text will stay there.
907It's really just a copy of what's at the front of the ring,
908so editing it does not change what's in the ring.
909And the ring,
910once rotated,
911stays rotated,
912so that doing another C-Y gets another copy of what you rotated to the
913front with ESC Y.
914.LP
915If you change your
916mind about un-killing,
917C-W gets rid of the un-killed text, even
918after any number of ESC Y's.
919.NH 1
920Searching
921.XS \n(PN
922\*(SN Searching
923.XE
924.LP
925The search commands are useful for finding and moving to arbitrary
926positions in the buffer in one swift motion.
927For example,
928if you just ran the spell program on a paper
929and you want to correct some word,
930you can use the search commands to move directly to that word. There are
931two flavors of search: \fIstring search\fP and \fIincremental search\fP.
932The former is the default flavor\(emif you want to use incremental search
933you must rearrange the key bindings (see below).
934.NH 2
935Conventional Search
936.XS \n(PN 5n
937\*(SN Conventional Search
938.XE
939.LP
940.IP "C-S" 15n
941Search forward.
942.IP "C-R" 15n
943Search backward.
944.LP
945To search for the string "FOO" you type "C-S FOO<return>".
946If \s-2JOVE\s0 finds
947FOO it moves point to the end of it; otherwise \s-2JOVE\s0 prints an error
948message and leaves point unchanged.
949C-S searches forward from point
950so only occurrences of FOO after point are found.
951To search in the other direction use C-R.
952It is exactly the same as C-S except it searches in the opposite direction,
953and if it finds the string,
954it leaves point at the beginning of it,
955not at the end as in C-S.
956.LP
957While \s-2JOVE\s0 is searching it prints the search string on the message line.
958This is so you know what \s-2JOVE\s0 is doing.
959When the system is heavily loaded and
960editing in exceptionally large buffers,
961searches can take several (sometimes many) seconds.
962.LP
963\s-2JOVE\s0 remembers the last search string you used,
964so if you want to search for the same string you can type "C-S <return>".
965If you mistyped the last search string,
966you can type C-S followed by C-R.
967C-R,
968as usual,
969inserts the default search string into the minibuffer,
970and then you can fix it up.
971.NH 2
972Incremental Search
973.XS \n(PN 5n
974\*(SN Incremental Search
975.XE
976.LP
977This search command is unusual in that is is \fIincremental\fP;
978it begins to search before you have typed the complete search string.
979As you type in the search string,
980\s-2JOVE\s0 shows you where it would be found.
981When you have typed enough characters to identify the place you want,
982you can stop.
983Depending on what you will do next,
984you may or may not need to terminate the search explicitly with a Return first.
985.LP
986The command to search is C-S (\fIi-search-forward\fP).
987C-S reads in characters and positions the cursor at the first
988occurrence of the characters that you have typed so far.
989If you type C-S and then F,
990the cursor moves in the text just after the next "F".
991Type an "O",
992and see the cursor move to after the next "FO".
993After another "O",
994the cursor is after the next "FOO".
995At the same time,
996the "FOO" has echoed on the message line.
997.LP
998If you type a mistaken character,
999you can rub it out.
1000After the FOO,
1001typing a Rubout makes the "O" disappear from the message line,
1002leaving only "FO".
1003The cursor moves back in the buffer to the "FO".
1004Rubbing out the "O" and "F" moves the cursor back to where you
1005started the search.
1006.LP
1007When you are satisfied with the place you have reached,
1008you can type a Return,
1009which stops searching,
1010leaving the cursor where the search brought it.
1011Also,
1012any command not specially meaningful in searches stops
1013the searching and is then executed.
1014Thus,
1015typing C-A would exit the search and then move to the beginning of the line.
1016Return is necessary only if the next character you want to type is a printing
1017character,
1018Rubout,
1019Return,
1020or another search command,
1021since those are the characters that have special meanings inside the search.
1022.LP
1023Sometimes you search for "FOO" and find it,
1024but not the one you hoped to find.
1025Perhaps there is a second FOO that you forgot about,
1026after the one you just found.
1027Then type another C-S and the cursor will find the next FOO.
1028This can be done any number of times.
1029If you overshoot,
1030you can return to previous finds by rubbing out the C-S's.
1031.LP
1032After you exit a search,
1033you can search for the same string again by typing just C-S C-S:
1034one C-S command to start the search and then
1035another C-S to mean "search again for the same string".
1036.LP
1037If your string is not found at all,
1038the message line says "Failing I-search".
1039The cursor is after the place where \s-2JOVE\s0 found as much of
1040your string as it could.
1041Thus,
1042if you search for FOOT and there is no FOOT,
1043you might see the cursor after the FOO in FOOL.
1044At this point there are several things you can do.
1045If your string was mistyped,
1046you can rub some of it out and correct it.
1047If you like the place you have found,
1048you can type Return or some other \s-2JOVE\s0 command
1049to "accept what the search offered".
1050Or you can type C-G,
1051which undoes the search altogether and positions you back where you started
1052the search.
1053.LP
1054You can also type C-R at any time to start searching backwards.
1055If a search fails because the place you started was too late in the file,
1056you should do this.
1057Repeated C-R's keep looking backward for more occurrences of the last search string.
1058A C-S starts going forward again.
1059C-R's can be rubbed out just like anything else.
1060.NH 2
1061Searching with Regular Expressions
1062.XS \n(PN 5n
1063\*(SN Searching with Regular Expressions
1064.XE
1065.LP
1066In addition to the searching facilities described above,
1067\s-2JOVE\s0
1068can search for patterns using regular expressions.
1069The handling of regular expressions in \s-2JOVE\s0 is like that of \fIed(1)\fP
1070or \fIvi(1)\fP, but with some notable additions.
1071The extra metacharacters understood by \s-2JOVE\s0 are \e<,
1072\e>,
1073\e\|| and \e\|{.
1074The first two of these match the beginnings and endings of words;
1075Thus the search pattern,
1076"\|\e<Exec" would match all words beginning with the letters "Exec".
1077.LP
1078An \e\|| signals the beginning of an alternative \(em that is, the
1079pattern "foo\e\||bar" would match either "foo" or "bar". The "curly
1080brace" is a way of introducing several sub-alternatives into a pattern.
1081It parallels the [] construct of regular expressions, except it specifies
1082a list of alternative words instead of just alternative characters. So
1083the pattern "foo\e\|{bar,baz\e\|}bie" matches "foobarbie" or "foobazbie".
1084.LP
1085\s-2JOVE\s0 only regards metacharacters as special if the variable
1086\fImatch-regular-expressions\fP is set to "on".
1087The ability to have \s-2JOVE\s0 ignore these characters is useful if
1088you're editing a document about patterns and regular expressions or
1089when a novice is learning \s-2JOVE\s0.
1090.LP
1091Another variable that affects searching is \fIcase-ignore-search\fP. If
1092this variable is set to "on" then upper case and lower case letters are
1093considered equal.
1094.NH 1
1095Replacement Commands
1096.XS \n(PN
1097\*(SN Replacement Commands
1098.XE
1099.LP
1100Global search-and-replace operations are not needed as often in \s-2JOVE\s0
1101as they are in other editors,
1102but they are available.
1103In addition to
1104the simple Replace operation which is like that found in most editors,
1105there is a Query Replace operation which asks,
1106for each occurrence of the pattern,
1107whether to replace it.
1108.NH 2
1109Global replacement
1110.XS \n(PN 5n
1111\*(SN Global Replacement
1112.XE
1113.LP
1114To replace every occurrence of FOO after point with BAR,
1115you can do, e.g., "ESC R FOO<return>BAR" as the \fIreplace-string\fP command
1116is bound to the ESC R.
1117Replacement takes place only between point and the end of the buffer
1118so if you want to cover the whole buffer you must go to the beginning first.
1119.NH 2
1120Query Replace
1121.XS \n(PN 5n
1122\*(SN Query Replace
1123.XE
1124.LP
1125If you want to change only some of the occurrences of FOO,
1126not all,
1127then the global \fIreplace-string\fP is inappropriate;
1128Instead,
1129use, e.g., "ESC Q FOO<return>BAR", to run the command \fIquery-replace-string\fP.
1130This displays each occurrence of FOO and waits for you to say whether
1131to replace it with a BAR.
1132The things you can type when you are shown an occurrence of FOO are:
1133.IP "Space" 15n
1134to replace the FOO.
1135.IP "Rubout" 15n
1136to skip to the next FOO without replacing this one.
1137.IP "Return" 15n
1138to stop without doing any more replacements.
1139.IP "Period" 15n
1140to replace this FOO and then stop.
1141.IP "! or P" 15n
1142to replace all remaining FOO's without asking.
1143.IP "C-R or R" 15n
1144to enter a recursive editing level,
1145in case the FOO needs to be edited rather than just replaced with a BAR.
1146When you are done,
1147exit the recursive editing level with C-X C-C and the next FOO will
1148be displayed.
1149.IP "C-W" 15n
1150to delete the FOO, and then start editing the buffer.
1151When you are finished editing whatever is to replace the FOO,
1152exit the recursive editing level with C-X C-C
1153and the next FOO will be displayed.
1154.IP "U" 15n
1155move to the last replacement and undo it.
1156.LP
1157Another alternative is using \fIreplace-in-region\fP which is just like
1158\fIreplace-string\fP except it searches only within the region.
1159.LP