2 cfa37a7b 2004-04-10 devnull .ds a \fR*\ \fP
4 058b0118 2005-01-03 devnull sam, B, E, sam.save, samterm, samsave \- screen editor with structural regular expressions
5 cfa37a7b 2004-04-10 devnull .SH SYNOPSIS
8 cfa37a7b 2004-04-10 devnull .I option ...
15 cfa37a7b 2004-04-10 devnull .I machine
17 cfa37a7b 2004-04-10 devnull .B sam.save
20 058b0118 2005-01-03 devnull .IB file \fR[\fP: line \fR]
25 cfa37a7b 2004-04-10 devnull .SH DESCRIPTION
27 cfa37a7b 2004-04-10 devnull is a multi-file editor.
28 cfa37a7b 2004-04-10 devnull It modifies a local copy of an external file.
29 cfa37a7b 2004-04-10 devnull The copy is here called a
30 cfa37a7b 2004-04-10 devnull .IR file .
31 cfa37a7b 2004-04-10 devnull The files are listed in a menu available through mouse button 3
35 cfa37a7b 2004-04-10 devnull Each file has an associated name, usually the name of the
36 cfa37a7b 2004-04-10 devnull external file from which it was read, and a `modified' bit that indicates whether
37 cfa37a7b 2004-04-10 devnull the editor's file agrees with the external file.
38 cfa37a7b 2004-04-10 devnull The external file is not read into
39 cfa37a7b 2004-04-10 devnull the editor's file until it first becomes the current file\(emthat to
40 cfa37a7b 2004-04-10 devnull which editing commands apply\(emwhereupon its menu entry is printed.
41 cfa37a7b 2004-04-10 devnull The options are
42 cfa37a7b 2004-04-10 devnull .TF -rmachine
45 cfa37a7b 2004-04-10 devnull Do not `download' the terminal part of
46 cfa37a7b 2004-04-10 devnull .IR sam .
47 cfa37a7b 2004-04-10 devnull Editing will be done with the command language only, as in
48 cfa37a7b 2004-04-10 devnull .IR ed (1).
50 cfa37a7b 2004-04-10 devnull .BI -r " machine
51 cfa37a7b 2004-04-10 devnull Run the host part remotely
52 cfa37a7b 2004-04-10 devnull on the specified machine, the terminal part locally.
54 cfa37a7b 2004-04-10 devnull .BI -s " path
55 cfa37a7b 2004-04-10 devnull Start the host part from the specified file on the remote host.
56 cfa37a7b 2004-04-10 devnull Only meaningful with the
60 cfa37a7b 2004-04-10 devnull .BI -t " path
61 cfa37a7b 2004-04-10 devnull Start the terminal part from the specified file. Useful
62 cfa37a7b 2004-04-10 devnull for debugging.
64 cfa37a7b 2004-04-10 devnull .SS Regular expressions
65 cfa37a7b 2004-04-10 devnull Regular expressions are as in
66 058b0118 2005-01-03 devnull .IR regexp (7)
67 cfa37a7b 2004-04-10 devnull with the addition of
69 cfa37a7b 2004-04-10 devnull to represent newlines.
70 cfa37a7b 2004-04-10 devnull A regular expression may never contain a literal newline character.
71 cfa37a7b 2004-04-10 devnull The empty
72 cfa37a7b 2004-04-10 devnull regular expression stands for the last complete expression encountered.
73 cfa37a7b 2004-04-10 devnull A regular expression in
75 cfa37a7b 2004-04-10 devnull matches the longest leftmost substring formally
76 cfa37a7b 2004-04-10 devnull matched by the expression.
77 cfa37a7b 2004-04-10 devnull Searching in the reverse direction is equivalent
78 cfa37a7b 2004-04-10 devnull to searching backwards with the catenation operations reversed in
79 cfa37a7b 2004-04-10 devnull the expression.
80 cfa37a7b 2004-04-10 devnull .SS Addresses
81 cfa37a7b 2004-04-10 devnull An address identifies a substring in a file.
82 cfa37a7b 2004-04-10 devnull In the following, `character
84 cfa37a7b 2004-04-10 devnull means the null string
85 cfa37a7b 2004-04-10 devnull after the
86 cfa37a7b 2004-04-10 devnull .IR n -th
87 cfa37a7b 2004-04-10 devnull character in the file, with 1 the
88 cfa37a7b 2004-04-10 devnull first character in the file.
91 cfa37a7b 2004-04-10 devnull means the
92 cfa37a7b 2004-04-10 devnull .IR n -th
94 cfa37a7b 2004-04-10 devnull starting at the beginning of the file, of the regular expression
95 cfa37a7b 2004-04-10 devnull .LR .*\en? .
96 cfa37a7b 2004-04-10 devnull All files always have a current substring, called dot,
97 cfa37a7b 2004-04-10 devnull that is the default address.
98 cfa37a7b 2004-04-10 devnull .SS Simple Addresses
102 cfa37a7b 2004-04-10 devnull The empty string after character
105 cfa37a7b 2004-04-10 devnull is the beginning of the file.
111 cfa37a7b 2004-04-10 devnull is the beginning of the file.
113 cfa37a7b 2004-04-10 devnull .BI / regexp /
116 cfa37a7b 2004-04-10 devnull .BI ? regexp ?
117 cfa37a7b 2004-04-10 devnull The substring that matches the regular expression,
118 cfa37a7b 2004-04-10 devnull found by looking toward the end
119 cfa37a7b 2004-04-10 devnull .RB ( / )
120 cfa37a7b 2004-04-10 devnull or beginning
121 cfa37a7b 2004-04-10 devnull .RB ( ? )
122 cfa37a7b 2004-04-10 devnull of the file,
123 cfa37a7b 2004-04-10 devnull and if necessary continuing the search from the other end to the
124 cfa37a7b 2004-04-10 devnull starting point of the search.
125 cfa37a7b 2004-04-10 devnull The matched substring may straddle
126 cfa37a7b 2004-04-10 devnull the starting point.
127 cfa37a7b 2004-04-10 devnull When entering a pattern containing a literal question mark
128 cfa37a7b 2004-04-10 devnull for a backward search, the question mark should be
129 cfa37a7b 2004-04-10 devnull specified as a member of a class.
133 cfa37a7b 2004-04-10 devnull The string before the first full line.
134 cfa37a7b 2004-04-10 devnull This is not necessarily
135 cfa37a7b 2004-04-10 devnull the null string; see
142 cfa37a7b 2004-04-10 devnull The null string at the end of the file.
148 cfa37a7b 2004-04-10 devnull The mark in the file (see the
150 cfa37a7b 2004-04-10 devnull command below).
152 cfa37a7b 2004-04-10 devnull \fB"\f2regexp\fB"\f1\f1
153 cfa37a7b 2004-04-10 devnull Preceding a simple address (default
154 cfa37a7b 2004-04-10 devnull .BR . ),
155 cfa37a7b 2004-04-10 devnull refers to the address evaluated in the unique file whose menu line
156 cfa37a7b 2004-04-10 devnull matches the regular expression.
158 cfa37a7b 2004-04-10 devnull .SS Compound Addresses
159 cfa37a7b 2004-04-10 devnull In the following,
163 cfa37a7b 2004-04-10 devnull are addresses.
164 cfa37a7b 2004-04-10 devnull .TF a1+a2
166 cfa37a7b 2004-04-10 devnull .IB a1 + a2
167 cfa37a7b 2004-04-10 devnull The address
169 cfa37a7b 2004-04-10 devnull evaluated starting at the end of
170 cfa37a7b 2004-04-10 devnull .IR a1 .
172 cfa37a7b 2004-04-10 devnull .IB a1 - a2
173 cfa37a7b 2004-04-10 devnull The address
175 cfa37a7b 2004-04-10 devnull evaluated looking in the reverse direction
176 cfa37a7b 2004-04-10 devnull starting at the beginning of
177 cfa37a7b 2004-04-10 devnull .IR a1 .
179 cfa37a7b 2004-04-10 devnull .IB a1 , a2
180 cfa37a7b 2004-04-10 devnull The substring from the beginning of
182 cfa37a7b 2004-04-10 devnull to the end of
183 cfa37a7b 2004-04-10 devnull .IR a2 .
186 cfa37a7b 2004-04-10 devnull is missing,
188 cfa37a7b 2004-04-10 devnull is substituted.
191 cfa37a7b 2004-04-10 devnull is missing,
193 cfa37a7b 2004-04-10 devnull is substituted.
195 cfa37a7b 2004-04-10 devnull .IB a1 ; a2
197 cfa37a7b 2004-04-10 devnull .IB a1 , a2\f1,
198 cfa37a7b 2004-04-10 devnull but with
200 cfa37a7b 2004-04-10 devnull evaluated at the end of, and dot set to,
201 cfa37a7b 2004-04-10 devnull .IR a1 .
204 cfa37a7b 2004-04-10 devnull The operators
208 cfa37a7b 2004-04-10 devnull are high precedence, while
212 cfa37a7b 2004-04-10 devnull are low precedence.
218 cfa37a7b 2004-04-10 devnull forms, if
220 cfa37a7b 2004-04-10 devnull is a line or character address with a missing
221 cfa37a7b 2004-04-10 devnull number, the number defaults to 1.
224 cfa37a7b 2004-04-10 devnull is missing,
226 cfa37a7b 2004-04-10 devnull is substituted.
231 cfa37a7b 2004-04-10 devnull are present and distinguishable,
233 cfa37a7b 2004-04-10 devnull may be elided.
235 cfa37a7b 2004-04-10 devnull may be a regular
236 cfa37a7b 2004-04-10 devnull expression; if it is delimited by
237 cfa37a7b 2004-04-10 devnull .LR ? 's,
238 cfa37a7b 2004-04-10 devnull the effect of the
242 cfa37a7b 2004-04-10 devnull is reversed.
244 cfa37a7b 2004-04-10 devnull It is an error for a compound address to represent a malformed substring.
245 cfa37a7b 2004-04-10 devnull Some useful idioms:
246 cfa37a7b 2004-04-10 devnull .IB a1 +-
247 cfa37a7b 2004-04-10 devnull \%(\f2a1\fB-+\f1)
248 cfa37a7b 2004-04-10 devnull selects the line containing
249 cfa37a7b 2004-04-10 devnull the end (beginning) of a1.
250 cfa37a7b 2004-04-10 devnull .BI 0/ regexp /
251 cfa37a7b 2004-04-10 devnull locates the first match of the expression in the file.
252 cfa37a7b 2004-04-10 devnull (The form
254 cfa37a7b 2004-04-10 devnull sets dot unnecessarily.)
255 cfa37a7b 2004-04-10 devnull .BI ./ regexp ///
256 cfa37a7b 2004-04-10 devnull finds the second following occurrence of the expression,
258 cfa37a7b 2004-04-10 devnull .BI .,/ regexp /
259 cfa37a7b 2004-04-10 devnull extends dot.
260 cfa37a7b 2004-04-10 devnull .SS Commands
261 cfa37a7b 2004-04-10 devnull In the following, text demarcated by slashes represents text delimited
262 cfa37a7b 2004-04-10 devnull by any printable
263 cfa37a7b 2004-04-10 devnull character except alphanumerics.
264 cfa37a7b 2004-04-10 devnull Any number of
265 cfa37a7b 2004-04-10 devnull trailing delimiters may be elided, with multiple elisions then representing
266 cfa37a7b 2004-04-10 devnull null strings, but the first delimiter must always
267 cfa37a7b 2004-04-10 devnull be present.
268 cfa37a7b 2004-04-10 devnull In any delimited text,
269 cfa37a7b 2004-04-10 devnull newline may not appear literally;
271 cfa37a7b 2004-04-10 devnull may be typed for newline; and
273 cfa37a7b 2004-04-10 devnull quotes the delimiter, here
275 cfa37a7b 2004-04-10 devnull Backslash is otherwise interpreted literally, except in
277 cfa37a7b 2004-04-10 devnull commands.
279 cfa37a7b 2004-04-10 devnull Most commands may be prefixed by an address to indicate their range
280 cfa37a7b 2004-04-10 devnull of operation.
281 cfa37a7b 2004-04-10 devnull Those that may not are marked with a
284 cfa37a7b 2004-04-10 devnull If a command takes
285 cfa37a7b 2004-04-10 devnull an address and none is supplied, dot is used.
286 cfa37a7b 2004-04-10 devnull The sole exception is
289 cfa37a7b 2004-04-10 devnull command, which defaults to
290 cfa37a7b 2004-04-10 devnull .BR 0,$ .
291 cfa37a7b 2004-04-10 devnull In the description, `range' is used
292 cfa37a7b 2004-04-10 devnull to represent whatever address is supplied.
293 cfa37a7b 2004-04-10 devnull Many commands set the
294 cfa37a7b 2004-04-10 devnull value of dot as a side effect.
295 cfa37a7b 2004-04-10 devnull If so, it is always set to the `result'
296 cfa37a7b 2004-04-10 devnull of the change: the empty string for a deletion, the new text for an
297 cfa37a7b 2004-04-10 devnull insertion, etc. (but see the
301 cfa37a7b 2004-04-10 devnull commands).
303 cfa37a7b 2004-04-10 devnull .ne 1.2i
304 cfa37a7b 2004-04-10 devnull .SS Text commands
307 cfa37a7b 2004-04-10 devnull .BI a/ text /
313 cfa37a7b 2004-04-10 devnull .I lines of text
316 cfa37a7b 2004-04-10 devnull Insert the text into the file after the range.
317 cfa37a7b 2004-04-10 devnull Set dot.
329 cfa37a7b 2004-04-10 devnull replaces the text, while
332 cfa37a7b 2004-04-10 devnull .I before
333 cfa37a7b 2004-04-10 devnull the range.
336 cfa37a7b 2004-04-10 devnull Delete the text in the range.
337 cfa37a7b 2004-04-10 devnull Set dot.
339 cfa37a7b 2004-04-10 devnull .BI s/ regexp / text /
340 cfa37a7b 2004-04-10 devnull Substitute
342 cfa37a7b 2004-04-10 devnull for the first match to the regular expression in the range.
343 cfa37a7b 2004-04-10 devnull Set dot to the modified range.
346 cfa37a7b 2004-04-10 devnull the character
348 cfa37a7b 2004-04-10 devnull stands for the string
349 cfa37a7b 2004-04-10 devnull that matched the expression.
350 cfa37a7b 2004-04-10 devnull Backslash behaves as usual unless followed by
351 cfa37a7b 2004-04-10 devnull a digit:
352 cfa37a7b 2004-04-10 devnull .BI \e d
353 cfa37a7b 2004-04-10 devnull stands for the string that matched the
354 cfa37a7b 2004-04-10 devnull subexpression begun by the
355 cfa37a7b 2004-04-10 devnull .IR d -th
356 cfa37a7b 2004-04-10 devnull left parenthesis.
359 cfa37a7b 2004-04-10 devnull is followed immediately by a
363 cfa37a7b 2004-04-10 devnull .BR s2/x/y/ ,
365 cfa37a7b 2004-04-10 devnull .IR n -th
366 cfa37a7b 2004-04-10 devnull match in the range is substituted.
368 cfa37a7b 2004-04-10 devnull command is followed by a
371 cfa37a7b 2004-04-10 devnull .BR s/x/y/g ,
372 cfa37a7b 2004-04-10 devnull all matches in the range
373 cfa37a7b 2004-04-10 devnull are substituted.
375 cfa37a7b 2004-04-10 devnull .BI m " a1
379 cfa37a7b 2004-04-10 devnull .BI t " a1
381 cfa37a7b 2004-04-10 devnull .RB ( m )
383 cfa37a7b 2004-04-10 devnull .RB ( t )
384 cfa37a7b 2004-04-10 devnull the range to after
385 cfa37a7b 2004-04-10 devnull .IR a1 .
386 cfa37a7b 2004-04-10 devnull Set dot.
387 cfa37a7b 2004-04-10 devnull .SS Display commands
391 cfa37a7b 2004-04-10 devnull Print the text in the range.
392 cfa37a7b 2004-04-10 devnull Set dot.
395 cfa37a7b 2004-04-10 devnull Print the line address and character address of the range.
398 cfa37a7b 2004-04-10 devnull Print just the character address of the range.
400 cfa37a7b 2004-04-10 devnull .SS File commands
403 cfa37a7b 2004-04-10 devnull .BI \*ab " file-list
404 cfa37a7b 2004-04-10 devnull Set the current file to the first file named in the list
407 cfa37a7b 2004-04-10 devnull also has in its menu.
408 cfa37a7b 2004-04-10 devnull The list may be expressed
409 cfa37a7b 2004-04-10 devnull .BI < "Plan 9 command"
410 cfa37a7b 2004-04-10 devnull in which case the file names are taken as words (in the shell sense)
411 cfa37a7b 2004-04-10 devnull generated by the Plan 9 command.
413 cfa37a7b 2004-04-10 devnull .BI \*aB " file-list
416 cfa37a7b 2004-04-10 devnull except that file names not in the menu are entered there,
417 cfa37a7b 2004-04-10 devnull and all file names in the list are examined.
420 cfa37a7b 2004-04-10 devnull Print a menu of files.
421 cfa37a7b 2004-04-10 devnull The format is:
424 cfa37a7b 2004-04-10 devnull .BR ' " or blank
425 cfa37a7b 2004-04-10 devnull indicating the file is modified or clean,
427 cfa37a7b 2004-04-10 devnull .BR - " or \&" +
428 cfa37a7b 2004-04-10 devnull indicating the file is unread or has been read
429 cfa37a7b 2004-04-10 devnull (in the terminal,
431 cfa37a7b 2004-04-10 devnull means more than one window is open),
433 cfa37a7b 2004-04-10 devnull .BR . " or blank
434 cfa37a7b 2004-04-10 devnull indicating the current file,
436 cfa37a7b 2004-04-10 devnull a blank,
438 cfa37a7b 2004-04-10 devnull and the file name.
441 cfa37a7b 2004-04-10 devnull .BI \*aD " file-list
442 cfa37a7b 2004-04-10 devnull Delete the named files from the menu.
443 cfa37a7b 2004-04-10 devnull If no files are named, the current file is deleted.
444 cfa37a7b 2004-04-10 devnull It is an error to
446 cfa37a7b 2004-04-10 devnull a modified file, but a subsequent
448 cfa37a7b 2004-04-10 devnull will delete such a file.
450 cfa37a7b 2004-04-10 devnull .SS I/O Commands
453 cfa37a7b 2004-04-10 devnull .BI \*ae " filename
454 cfa37a7b 2004-04-10 devnull Replace the file by the contents of the named external file.
455 cfa37a7b 2004-04-10 devnull Set dot to the beginning of the file.
457 cfa37a7b 2004-04-10 devnull .BI r " filename
458 cfa37a7b 2004-04-10 devnull Replace the text in the range by the contents of the named external file.
459 cfa37a7b 2004-04-10 devnull Set dot.
461 cfa37a7b 2004-04-10 devnull .BI w " filename
462 cfa37a7b 2004-04-10 devnull Write the range (default
463 cfa37a7b 2004-04-10 devnull .BR 0,$ )
464 cfa37a7b 2004-04-10 devnull to the named external file.
466 cfa37a7b 2004-04-10 devnull .BI \*af " filename
467 cfa37a7b 2004-04-10 devnull Set the file name and print the resulting menu entry.
469 cfa37a7b 2004-04-10 devnull If the file name is absent from any of these, the current file name is used.
471 cfa37a7b 2004-04-10 devnull always sets the file name;
475 cfa37a7b 2004-04-10 devnull do so if the file has no name.
477 cfa37a7b 2004-04-10 devnull .BI < " Plan 9-command
478 cfa37a7b 2004-04-10 devnull Replace the range by the standard output of the
479 cfa37a7b 2004-04-10 devnull Plan 9 command.
481 cfa37a7b 2004-04-10 devnull .BI > " Plan 9-command
482 cfa37a7b 2004-04-10 devnull Send the range to the standard input of the
483 cfa37a7b 2004-04-10 devnull Plan 9 command.
485 cfa37a7b 2004-04-10 devnull .BI | " Plan 9-command
486 cfa37a7b 2004-04-10 devnull Send the range to the standard input, and replace it by
487 cfa37a7b 2004-04-10 devnull the standard output, of the
488 cfa37a7b 2004-04-10 devnull Plan 9 command.
490 cfa37a7b 2004-04-10 devnull .BI \*a! " Plan 9-command
492 cfa37a7b 2004-04-10 devnull Plan 9 command.
494 cfa37a7b 2004-04-10 devnull .BI \*acd " directory
495 cfa37a7b 2004-04-10 devnull Change working directory.
496 cfa37a7b 2004-04-10 devnull If no directory is specified,
497 cfa37a7b 2004-04-10 devnull .B $home
498 cfa37a7b 2004-04-10 devnull is used.
501 cfa37a7b 2004-04-10 devnull In any of
508 cfa37a7b 2004-04-10 devnull .I Plan 9 command
509 cfa37a7b 2004-04-10 devnull is omitted the last
510 cfa37a7b 2004-04-10 devnull .I Plan 9 command
511 cfa37a7b 2004-04-10 devnull (of any type) is substituted.
515 cfa37a7b 2004-04-10 devnull .I downloaded
516 cfa37a7b 2004-04-10 devnull (using the mouse and raster display, i.e. not using option
517 cfa37a7b 2004-04-10 devnull .BR -d ),
519 cfa37a7b 2004-04-10 devnull sets standard input to
520 cfa37a7b 2004-04-10 devnull .BR /dev/null ,
521 cfa37a7b 2004-04-10 devnull and otherwise
522 cfa37a7b 2004-04-10 devnull unassigned output
523 cfa37a7b 2004-04-10 devnull .RB ( stdout
528 cfa37a7b 2004-04-10 devnull .B stderr
529 cfa37a7b 2004-04-10 devnull for all) is placed in
530 cfa37a7b 2004-04-10 devnull .B /tmp/sam.err
531 cfa37a7b 2004-04-10 devnull and the first few lines are printed.
532 cfa37a7b 2004-04-10 devnull .SS Loops and Conditionals
535 cfa37a7b 2004-04-10 devnull .BI x/ regexp / " command
536 cfa37a7b 2004-04-10 devnull For each match of the regular expression in the range, run the command
537 cfa37a7b 2004-04-10 devnull with dot set to the match.
538 cfa37a7b 2004-04-10 devnull Set dot to the last match.
539 cfa37a7b 2004-04-10 devnull If the regular
540 cfa37a7b 2004-04-10 devnull expression and its slashes are omitted,
541 cfa37a7b 2004-04-10 devnull .L /.*\en/
542 cfa37a7b 2004-04-10 devnull is assumed.
543 cfa37a7b 2004-04-10 devnull Null string matches potentially occur before every character
544 cfa37a7b 2004-04-10 devnull of the range and at the end of the range.
546 cfa37a7b 2004-04-10 devnull .BI y/ regexp / " command
549 cfa37a7b 2004-04-10 devnull but run the command for each substring that lies before, between,
550 cfa37a7b 2004-04-10 devnull or after
551 cfa37a7b 2004-04-10 devnull the matches that would be generated by
553 cfa37a7b 2004-04-10 devnull There is no default regular expression.
554 cfa37a7b 2004-04-10 devnull Null substrings potentially occur before every character
555 cfa37a7b 2004-04-10 devnull in the range.
557 cfa37a7b 2004-04-10 devnull .BI \*aX/ regexp / " command
558 cfa37a7b 2004-04-10 devnull For each file whose menu entry matches the regular expression,
559 cfa37a7b 2004-04-10 devnull make that the current file and
560 cfa37a7b 2004-04-10 devnull run the command.
561 cfa37a7b 2004-04-10 devnull If the expression is omitted, the command is run
562 cfa37a7b 2004-04-10 devnull in every file.
564 cfa37a7b 2004-04-10 devnull .BI \*aY/ regexp / " command
567 cfa37a7b 2004-04-10 devnull but for files that do not match the regular expression,
568 cfa37a7b 2004-04-10 devnull and the expression is required.
570 cfa37a7b 2004-04-10 devnull .BI g/ regexp / " command
574 cfa37a7b 2004-04-10 devnull .BI v/ regexp / " command
575 cfa37a7b 2004-04-10 devnull If the range contains
576 cfa37a7b 2004-04-10 devnull .RB ( g )
577 cfa37a7b 2004-04-10 devnull or does not contain
578 cfa37a7b 2004-04-10 devnull .RB ( v )
579 cfa37a7b 2004-04-10 devnull a match for the expression,
580 cfa37a7b 2004-04-10 devnull set dot to the range and run the command.
582 cfa37a7b 2004-04-10 devnull These may be nested arbitrarily deeply, but only one instance of either
586 cfa37a7b 2004-04-10 devnull may appear in a \%single command.
587 cfa37a7b 2004-04-10 devnull An empty command in an
591 cfa37a7b 2004-04-10 devnull defaults to
593 cfa37a7b 2004-04-10 devnull an empty command in
597 cfa37a7b 2004-04-10 devnull defaults to
602 cfa37a7b 2004-04-10 devnull do not have defaults.
604 cfa37a7b 2004-04-10 devnull .SS Miscellany
605 cfa37a7b 2004-04-10 devnull .TF (empty)
608 cfa37a7b 2004-04-10 devnull Set the current file's mark to the range. Does not set dot.
612 cfa37a7b 2004-04-10 devnull It is an error to quit with modified files, but a second
614 cfa37a7b 2004-04-10 devnull will succeed.
616 cfa37a7b 2004-04-10 devnull .BI \*au " n
617 cfa37a7b 2004-04-10 devnull Undo the last
619 cfa37a7b 2004-04-10 devnull (default 1)
620 cfa37a7b 2004-04-10 devnull top-level commands that changed the contents or name of the
621 cfa37a7b 2004-04-10 devnull current file, and any other file whose most recent change was simultaneous
622 cfa37a7b 2004-04-10 devnull with the current file's change.
623 cfa37a7b 2004-04-10 devnull Successive
624 cfa37a7b 2004-04-10 devnull .BR u 's
625 cfa37a7b 2004-04-10 devnull move further back in time.
626 cfa37a7b 2004-04-10 devnull The only commands for which u is ineffective are
627 cfa37a7b 2004-04-10 devnull .BR cd ,
635 cfa37a7b 2004-04-10 devnull is negative,
637 cfa37a7b 2004-04-10 devnull `redoes,' undoing the undo, going forwards in time again.
640 cfa37a7b 2004-04-10 devnull If the range is explicit, set dot to the range.
643 cfa37a7b 2004-04-10 devnull is downloaded, the resulting dot is selected on the screen;
644 cfa37a7b 2004-04-10 devnull otherwise it is printed.
645 cfa37a7b 2004-04-10 devnull If no address is specified (the
646 cfa37a7b 2004-04-10 devnull command is a newline) dot is extended in either direction to
647 cfa37a7b 2004-04-10 devnull line boundaries and printed.
648 cfa37a7b 2004-04-10 devnull If dot is thereby unchanged, it is set to
650 cfa37a7b 2004-04-10 devnull and printed.
652 cfa37a7b 2004-04-10 devnull .SS Grouping and multiple changes
653 cfa37a7b 2004-04-10 devnull Commands may be grouped by enclosing them in braces
654 cfa37a7b 2004-04-10 devnull .BR {} .
655 cfa37a7b 2004-04-10 devnull Commands within the braces must appear on separate lines (no backslashes are
656 cfa37a7b 2004-04-10 devnull required between commands).
657 cfa37a7b 2004-04-10 devnull Semantically, an opening brace is like a command:
658 cfa37a7b 2004-04-10 devnull it takes an (optional) address and sets dot for each sub-command.
659 cfa37a7b 2004-04-10 devnull Commands within the braces are executed sequentially, but changes made
660 cfa37a7b 2004-04-10 devnull by one command are not visible to other commands (see the next
661 cfa37a7b 2004-04-10 devnull paragraph).
662 cfa37a7b 2004-04-10 devnull Braces may be nested arbitrarily.
664 cfa37a7b 2004-04-10 devnull When a command makes a number of changes to a file, as in
665 cfa37a7b 2004-04-10 devnull .BR x/re/c/text/ ,
666 cfa37a7b 2004-04-10 devnull the addresses of all changes to the file are computed in the original file.
667 cfa37a7b 2004-04-10 devnull If the changes are in sequence,
668 cfa37a7b 2004-04-10 devnull they are applied to the file.
669 cfa37a7b 2004-04-10 devnull Successive insertions at the same address are catenated into a single
670 cfa37a7b 2004-04-10 devnull insertion composed of the several insertions in the order applied.
671 cfa37a7b 2004-04-10 devnull .SS The terminal
672 cfa37a7b 2004-04-10 devnull What follows refers to behavior of
674 cfa37a7b 2004-04-10 devnull when downloaded, that is, when
675 cfa37a7b 2004-04-10 devnull operating as a display editor on a raster display.
676 cfa37a7b 2004-04-10 devnull This is the default
677 cfa37a7b 2004-04-10 devnull behavior; invoking
679 cfa37a7b 2004-04-10 devnull with the
681 cfa37a7b 2004-04-10 devnull (no download) option provides access
682 cfa37a7b 2004-04-10 devnull to the command language only.
684 cfa37a7b 2004-04-10 devnull Each file may have zero or more windows open.
685 cfa37a7b 2004-04-10 devnull Each window is equivalent
686 cfa37a7b 2004-04-10 devnull and is updated simultaneously with changes in other windows on the same file.
687 cfa37a7b 2004-04-10 devnull Each window has an independent value of dot, indicated by a highlighted
688 cfa37a7b 2004-04-10 devnull substring on the display.
689 cfa37a7b 2004-04-10 devnull Dot may be in a region not within
690 cfa37a7b 2004-04-10 devnull the window.
691 cfa37a7b 2004-04-10 devnull There is usually a `current window',
692 cfa37a7b 2004-04-10 devnull marked with a dark border, to which typed text and editing
693 cfa37a7b 2004-04-10 devnull commands apply.
694 cfa37a7b 2004-04-10 devnull Text may be typed and edited as in
695 cfa37a7b 2004-04-10 devnull .IR rio (1);
696 cfa37a7b 2004-04-10 devnull also the escape key (ESC) selects (sets dot to) text typed
697 cfa37a7b 2004-04-10 devnull since the last mouse button hit.
699 cfa37a7b 2004-04-10 devnull The button 3 menu controls window operations.
700 cfa37a7b 2004-04-10 devnull The top of the menu
701 cfa37a7b 2004-04-10 devnull provides the following operators, each of which uses one or
703 cfa37a7b 2004-04-10 devnull .IR rio -like
704 cfa37a7b 2004-04-10 devnull cursors to prompt for selection of a window or sweeping
705 cfa37a7b 2004-04-10 devnull of a rectangle.
706 cfa37a7b 2004-04-10 devnull `Sweeping' a null rectangle gets a large window, disjoint
707 cfa37a7b 2004-04-10 devnull from the command window or the whole screen, depending on
708 cfa37a7b 2004-04-10 devnull where the null rectangle is.
709 cfa37a7b 2004-04-10 devnull .TF resize
712 cfa37a7b 2004-04-10 devnull Create a new, empty file.
714 cfa37a7b 2004-04-10 devnull .B zerox
715 cfa37a7b 2004-04-10 devnull Create a copy of an existing window.
717 cfa37a7b 2004-04-10 devnull .B resize
719 cfa37a7b 2004-04-10 devnull .IR rio .
721 cfa37a7b 2004-04-10 devnull .B close
722 cfa37a7b 2004-04-10 devnull Delete the window.
723 cfa37a7b 2004-04-10 devnull In the last window of a file,
724 cfa37a7b 2004-04-10 devnull .B close
725 cfa37a7b 2004-04-10 devnull is equivalent to a
727 cfa37a7b 2004-04-10 devnull for the file.
729 cfa37a7b 2004-04-10 devnull .B write
730 cfa37a7b 2004-04-10 devnull Equivalent to a
732 cfa37a7b 2004-04-10 devnull for the file.
735 cfa37a7b 2004-04-10 devnull Below these operators is a list of available files, starting with
736 cfa37a7b 2004-04-10 devnull .BR ~~sam~~ ,
737 cfa37a7b 2004-04-10 devnull the command window.
738 cfa37a7b 2004-04-10 devnull Selecting a file from the list makes the most recently
739 cfa37a7b 2004-04-10 devnull used window on that file current, unless it is already current, in which
740 cfa37a7b 2004-04-10 devnull case selections cycle through the open windows.
741 cfa37a7b 2004-04-10 devnull If no windows are open
742 cfa37a7b 2004-04-10 devnull on the file, the user is prompted to open one.
743 cfa37a7b 2004-04-10 devnull Files other than
744 cfa37a7b 2004-04-10 devnull .B ~~sam~~
745 cfa37a7b 2004-04-10 devnull are marked with one of the characters
747 cfa37a7b 2004-04-10 devnull according as zero, one, or more windows
748 cfa37a7b 2004-04-10 devnull are open on the file.
749 cfa37a7b 2004-04-10 devnull A further mark
751 cfa37a7b 2004-04-10 devnull appears on the file in the current window and
752 cfa37a7b 2004-04-10 devnull a single quote,
754 cfa37a7b 2004-04-10 devnull on a file modified since last write.
756 cfa37a7b 2004-04-10 devnull The command window, created automatically when
758 cfa37a7b 2004-04-10 devnull starts, is an ordinary window except that text typed to it
759 cfa37a7b 2004-04-10 devnull is interpreted as commands for the editor rather than passive text,
760 cfa37a7b 2004-04-10 devnull and text printed by editor commands appears in it.
761 cfa37a7b 2004-04-10 devnull The behavior is like
762 cfa37a7b 2004-04-10 devnull .IR rio ,
763 cfa37a7b 2004-04-10 devnull with an `output point' that separates commands being typed from
764 cfa37a7b 2004-04-10 devnull previous output.
765 cfa37a7b 2004-04-10 devnull Commands typed in the command window apply to the
766 cfa37a7b 2004-04-10 devnull current open file\(emthe file in the most recently
767 cfa37a7b 2004-04-10 devnull current window.
768 cfa37a7b 2004-04-10 devnull .SS Manipulating text
769 cfa37a7b 2004-04-10 devnull Button 1 changes selection, much like
770 cfa37a7b 2004-04-10 devnull .IR rio .
771 cfa37a7b 2004-04-10 devnull Pointing to a non-current window with button 1 makes it current;
772 cfa37a7b 2004-04-10 devnull within the current window, button 1 selects text, thus setting dot.
773 cfa37a7b 2004-04-10 devnull Double-clicking selects text to the boundaries of words, lines,
774 cfa37a7b 2004-04-10 devnull quoted strings or bracketed strings, depending on the text at the click.
776 cfa37a7b 2004-04-10 devnull Button 2 provides a menu of editing commands:
777 cfa37a7b 2004-04-10 devnull .TF /regexp
780 cfa37a7b 2004-04-10 devnull Delete dot and save the deleted text in the snarf buffer.
782 cfa37a7b 2004-04-10 devnull .B paste
783 cfa37a7b 2004-04-10 devnull Replace the text in dot by the contents of the snarf buffer.
785 cfa37a7b 2004-04-10 devnull .B snarf
786 cfa37a7b 2004-04-10 devnull Save the text in dot in the snarf buffer.
788 cfa37a7b 2004-04-10 devnull .B plumb
789 cfa37a7b 2004-04-10 devnull Send the text in the selection as a plumb
790 cfa37a7b 2004-04-10 devnull message. If the selection is empty,
791 cfa37a7b 2004-04-10 devnull the white-space-delimited block of text is sent as a plumb message
793 cfa37a7b 2004-04-10 devnull .B click
794 cfa37a7b 2004-04-10 devnull attribute defining where the selection lies (see
795 058b0118 2005-01-03 devnull .IR plumb (7)).
798 cfa37a7b 2004-04-10 devnull Search forward for the next occurrence of the literal text in dot.
799 cfa37a7b 2004-04-10 devnull If dot is the null string, the text in the snarf buffer is
801 cfa37a7b 2004-04-10 devnull The snarf buffer is unaffected.
803 cfa37a7b 2004-04-10 devnull .B <rio>
804 cfa37a7b 2004-04-10 devnull Exchange snarf buffers with
805 cfa37a7b 2004-04-10 devnull .IR rio .
807 cfa37a7b 2004-04-10 devnull .BI / regexp
808 cfa37a7b 2004-04-10 devnull Search forward for the next match of the last regular expression
809 cfa37a7b 2004-04-10 devnull typed in a command.
810 cfa37a7b 2004-04-10 devnull (Not in command window.)
813 cfa37a7b 2004-04-10 devnull Send the text in dot, or the snarf buffer if
814 cfa37a7b 2004-04-10 devnull dot is the null string, as if it were typed to the command window.
815 cfa37a7b 2004-04-10 devnull Saves the sent text in the snarf buffer.
816 cfa37a7b 2004-04-10 devnull (Command window only.)
818 cfa37a7b 2004-04-10 devnull .SS External communication
820 cfa37a7b 2004-04-10 devnull listens to the
822 cfa37a7b 2004-04-10 devnull plumb port.
823 cfa37a7b 2004-04-10 devnull If plumbing is not active,
824 cfa37a7b 2004-04-10 devnull on invocation
826 cfa37a7b 2004-04-10 devnull creates a named pipe
827 cfa37a7b 2004-04-10 devnull .BI /srv/sam. user
828 cfa37a7b 2004-04-10 devnull which acts as an additional source of commands. Characters written to
829 cfa37a7b 2004-04-10 devnull the named pipe are treated as if they had been typed in the command window.
832 cfa37a7b 2004-04-10 devnull is a shell-level command that causes an instance of
834 cfa37a7b 2004-04-10 devnull running on the same terminal to load the named
835 cfa37a7b 2004-04-10 devnull .IR files .
837 cfa37a7b 2004-04-10 devnull uses either plumbing or the named pipe, whichever service is available.
838 cfa37a7b 2004-04-10 devnull If plumbing is not enabled,
839 cfa37a7b 2004-04-10 devnull the option allows a line number to be specified for
840 cfa37a7b 2004-04-10 devnull the initial position to display in the last named file
841 cfa37a7b 2004-04-10 devnull (plumbing provides a more general mechanism for this ability).
844 058b0118 2005-01-03 devnull is a shell-level command that can be used as
845 058b0118 2005-01-03 devnull .B $EDITOR
846 058b0118 2005-01-03 devnull in a Unix environment.
851 c8b6342d 2005-01-13 devnull and then does not exit until
853 058b0118 2005-01-03 devnull is changed, which is taken as a signal that
855 058b0118 2005-01-03 devnull is done being edited.
856 cfa37a7b 2004-04-10 devnull .SS Abnormal termination
859 cfa37a7b 2004-04-10 devnull terminates other than by a
861 cfa37a7b 2004-04-10 devnull command (by hangup, deleting its window, etc.), modified
862 cfa37a7b 2004-04-10 devnull files are saved in an
863 cfa37a7b 2004-04-10 devnull executable file,
864 c8b6342d 2005-01-13 devnull .BR $HOME/sam.save .
865 cfa37a7b 2004-04-10 devnull This program, when executed, asks whether to write
866 cfa37a7b 2004-04-10 devnull each file back to a external file.
867 cfa37a7b 2004-04-10 devnull The answer
869 cfa37a7b 2004-04-10 devnull causes writing; anything else skips the file.
870 cfa37a7b 2004-04-10 devnull .SH FILES
871 c8b6342d 2005-01-13 devnull .TF $HOME/sam.save
873 c8b6342d 2005-01-13 devnull .B $HOME/sam.save
875 c8b6342d 2005-01-13 devnull .B $HOME/sam.err
877 c3674de4 2005-01-11 devnull .B \*9/bin/samsave
878 cfa37a7b 2004-04-10 devnull the program called to unpack
879 c8b6342d 2005-01-13 devnull .BR $HOME/sam.save .
880 cfa37a7b 2004-04-10 devnull .SH SOURCE
881 c3674de4 2005-01-11 devnull .TF \*9/src/cmd/samterm
883 c3674de4 2005-01-11 devnull .B \*9/src/cmd/sam
884 cfa37a7b 2004-04-10 devnull source for
888 c3674de4 2005-01-11 devnull .B \*9/src/cmd/samterm
889 cfa37a7b 2004-04-10 devnull source for the separate terminal part
891 c3674de4 2005-01-11 devnull .B \*9/bin/B
893 c8b6342d 2005-01-13 devnull .B \*9/bin/E
894 cfa37a7b 2004-04-10 devnull .SH SEE ALSO
895 cfa37a7b 2004-04-10 devnull .IR ed (1),
896 cfa37a7b 2004-04-10 devnull .IR sed (1),
897 cfa37a7b 2004-04-10 devnull .IR grep (1),
898 cfa37a7b 2004-04-10 devnull .IR rio (1),
899 058b0118 2005-01-03 devnull .IR regexp (7).
901 cfa37a7b 2004-04-10 devnull Rob Pike,
902 cfa37a7b 2004-04-10 devnull ``The text editor sam''.