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