summaryrefslogtreecommitdiff
path: root/editors/teco/files/teco.1.in
blob: 1df2c4a0a8e573c9dc4219aea0d2be6205933db2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
.Dd September 05, 2018
.Os
.Dt TECO 1 CON
.Sh NAME
.Nm teco
.Nd The grand old text editor
.Sh SYNOPSIS
.Cm tecoc
.Cm make
.Op Fl noini
.Op Fl nomemory
.Ar file
.br
.Cm tecoc
.Cm teco
.Op Fl inspect
.Op Fl nocreate
.Op Fl noini
.Op Fl nomemory
.Op Fl nopage
.Op Fl norename
.Op Sy +nnn
.Ar file
.br
.Cm tecoc
.Cm mung
.Op Fl noini
.Ar file
.Sh DESCRIPTION
This description section is sufficiently long that it has been split into a number of subsections.
.Ss Command names
.Nm
is actually invoked by the command
.Sy tecoc .
It takes a first argument of
.Cm make ,
.Cm teco ,
or
.Cm mung
to control its operating mode. In the
.Fx
version, the base name of the invoking command is tested to provide this
first argument. For ease of use, it is recommended that aliases are set
up. The recommended (and usual) mappings are:
.Bl -tag -width inspect
.It Sy Make
to
.Sy tecoc make
(note the uppercase first letter to avoid confusion with
.Xr make 1 )
.It Sy teco
to
.Sy tecoc teco
.It Sy mung
to
.Sy tecoc mung
.It Sy inspect
to
.Sy tecoc teco -inspect
.El
.Pp
These mappings are assumed in the
.Sx Options
and
.Sx Command invocations
sections below.
.Ss Options
Options may be abbreviated; for each option, the part shown in brackets can be omitted.
The following options are available for the
.Nm
command:
.Bl -tag -width nocreate
.It Fl in[spect]
read the file only, don't create an output file.
.It Fl noc[reate]
if the file doesn't exist, don't create it.
.It Fl noi[ni]
don't execute the initialisation file. This is valid for
.Sy Make
or
.Sy mung
as well.
.It Fl nom[emory]
don't remember the filename (see
.Sx Filename memory
below). This is valid for
.Sy Make
also.
.It Fl nop[age]
don't separate input into pages. Instead, treat form feeds as normal characters.
.It Fl nor[ename]
don't rename files, but copy them to keep references correct
.It Sy +nnn
where
.Ar nnn
is any number of digits. Go to line number
.Ar nnn
and set
.Fl nopage .
.El
.Ss Command invocations
.Pp
There are a number of different ways of starting
.Nm .
.Bl -tag
.It Sy Make Ar file
starts
.Nm
to create
.Ar file .
.br
This is equivalent to
.Li EWfile$$
.It Sy teco Ar file
starts
.Nm
to edit
.Ar file .
.br
This is equivalent to
.Li EBfile$Y$$
.It Sy teco Ar file2=file1
starts
.Nm
to edit
.Ar file1 ,
writing to
.Ar file2.
.br
This is equivalent to
.Li ERfile1$EWfile2$Y$$
.It Sy teco
starts
.Nm
to edit the last edited file.
By default, the name of that file is saved in a file named
.Pa tecoN.tmp
in the current directory, where
.Em N
is the process ID of the parent process to
.Nm .
This can be overridden, as described in
.Sx Filename memory
below.
.It Sy mung Ar file args
starts
.Nm
to execute
.Ar file.
.br
This is equivalent to
.Li I<args>$JEIfile$$ 
.br
Instead of
.Sy mung ,
the command
.Sy teco Ar @file args
can be used.
.El
.Pp
.Ss Key Bindings
The keys mentioned in the
.Pa teco.doc
file are somewhat confusing. This should help:
.Bl -tag -width <DELETE>
.It Li <DELIM>
The
.Li Esc
echoes as
.Li $ ,
however the
.Pa teco.doc
file shows it as
.Li ` .
.It Li <BS>
Type as
.Li Control-H ;
this isn't the
.Li Backspace
key.
.It Li <DELETE>
The
.Li Backspace
key; this isn't the
.Li Delete
key.
.It Li <CR>
The
.Li Enter
key.
.It Li <LF>
Type as
.Li Control-J .
.El
.Pp
Note that the assignments for
.Li <BS>
and
.Li <DELETE>
shown here are
swapped.
.Li <BS>
can be
.Li Backspace
and
.Li <DELETE>
can be
.Li Control-H
by
clearing
.Li ET&2048 ,
e.g.
.Li 2048,0ET
.Ss Initialisation file
.Nm
.Em mungs
(executes as
.Nm
commands) the file
.Pa TECO.INI
(yes, in uppercase) in the
current directory before processing the command line. Initialisation
can be done instead by defining an environment variable named
.Ev TEC_INIT .
The value is either the list of
.Nm
commands to execute, or a
.Li $
followed by the pathname of the initialisation file. This allows a
single, centrally located initialisation file. Remember that the
.Li $
must be escaped with a backslash character.
.Pp
The initialisation file can be used to make initial settings. It can
return a value, but the value setting is somewhat obscure.
.Pp
For example, the following will both cause successful searches to
auto-display in all
.Nm
sessions.
.Pp
.Bl -tag -compact -offset indent -width Examplex(bash)x
.It Example (csh):
.Li setenv
.Ev TEC_INIT
1es
.It Example (bash):
.Li TEC_INIT=1es
.br
.Li export TEC_INIT
.El
.Pp
The following will each cause the file
.Pa ~/.tecrc
to be used as the initialisation file.
.Bl -tag -compact -offset indent -width Examplex(bash)x
.It Example (csh):
.Li setenv TEC_INIT \e$~/.tecrc
.It Example (bash):
.Li TEC_INIT=\e$~/.tecrc
.br
.Li export TEC_INIT
.El
.Ss Filename memory
.Nm
tries to remember the last file that it edited,
so that after a file has been edited once, it can be re-edited without
the file name having to be repeated on the command line.
.Nm
implements this by writing and reading a file that contains
the name of the last file edited. By default, the file name is
.Pa tecoN.tmp
in the current directory, where
.Em N
is the process ID of the parent process to
.Nm .
.Pp
To change the location of the memory file,
define the environment variable
.Ev TEC_MEMORY
to be
.Li $
followed by the
pathname of the file to be designated as the memory file.
Remember that the
.Li $
must be escaped with a backslash character.
.Pp
The following examples will cause the name of the last
file edited to be stored in the file
.Pa teco.mem
in the home directory.
.Pp
.Bl -tag -compact -offset indent -width Examplex(bash)x
.It Example (csh):
.Li setenv TEC_MEMORY \e$~/teco.mem
.It Example (bash):
.Li TEC_MEMORY=\e$~/teco.mem
.br
.Li export TEC_MEMORY
.El
.Pp
.Ss Library directory
The environment variable
.Ev TEC_LIBRARY
can be set to be a directory path (including the final
.Pa / Ns );
the path must be preceded by a
.Li $
character. This allows the
.Li EI
command to fetch
.Nm
commands from this directory if the file is not found in the
current directory. Remember that the
.Li $
must be escaped with a backslash character.
.Pp
.Bl -tag -compact -offset indent -width Examplex(bash)x
.It Example (csh):
.Li setenv TEC_LIBRARY \e$%%PREFIX%%/lib/
.It Example (bash):
.Li TEC_LIBRARY=\e$/usr/%%PREFIX%%/lib/
.br
.Li export TEC_LIBRARY
.El
.Pp
This will cause the directory
.Pa %%PREFIX%%/lib
to be searched for
.Nm teco
command files.
.Ss Implemented flags
There are a number of flags that can be set inside
.Nm ,
using the
.Li ED
and
.Li ET
mode control commands. To add functionality,
.Nm
is also sensitive to bits in an extra mode control
flag,
.Li EZ .
Bits in the
.Li EZ
mode control command are
used in different ways by different operating systems; only those
relevant to
.Fx
are described here.
.Pp
.Bl -tag -compact -offset indent -width ETx32768
.It Li ED&1
Allow the caret
.Li ^
character in string searches.
.It Li ED&2
Allow yank and _ unconditionally.
.It Li ED&16
Failed searches preserve dot.
.It Li ED&64
Move dot by one after each match in multiple occurrence searches.
.El
.Pp
.Bl -tag -compact -offset indent -width ETx32768
.It Li ET&1
Type out in image mode.
.It Li ET&2
Use scope for delete and
.Li Control-U
(default=1)
.It Li ET&4
Accept lowercase input (default=1).
.It Li ET&8
.Li Control-T
reads without echo.
.It Li ET&32
.Li Control-T
reads with no wait.
.It Li ET&128
.Em mung
mode (abort on error); cleared by
.Li *
prompt.
.It Li ET&2048
Swap backspace and delete.
.It Li ET&4096
We are using 8 bit characters (default=1).
.It Li ET&32768
Trap
.Li Control-C .
.El
.Pp
.Bl -tag -compact -offset indent -width ET&32768
.It Li EZ&128
If set, don't stop on form feeds when reading. If clear, a form
feed in the input stream stops the read (the standard
.Nm
style).
This bit is off by default.
.It Li EZ&256
If set, use UNIX-style newline terminators. This means when files
are read in, carriage-returns are not added to the end of lines,
and when the user types the RETURN key, only a newline is entered
into the command line (usually a carriage-return/line-feed pair is
entered). Old macros (and old
.Nm
users) may get confused if this
bit is set.
.It Li EZ&16384
Normally, the backup file name is created by replacing the file extension
with
.Pa .bak
-
.Pa foo.c
becomes
.Pa foo.bak ;
however, if this bit is set then the backup file name is created by simply
adding
.Pa .bak
to the name -
.Pa foo.c
becomes
.Pa foo.c.bak .
This choice is overridden by
.Li EZ&1 = 0 .
.El
.Sh ENVIRONMENT
The following environment variables are used by
.Nm :
.Bl -tag -width TECO_LIBRARY
.It Ev TECO_INIT
The value of this variable can be either a
.Nm
command string, or the name of a file containing
.Nm
commands. The filename must be preceded by a
.Li $
character. Remember that the
.Li $
must be escaped with a backslash character.
See also
.Sx Initialisation file Ns No .
.It Ev TECO_LIBRARY
The value of this variable should be a path to the directory
that contains files of
.Nm
commands, to be accessed using
.Li XX .
The pathname should include the trailing
.Li / Ns No .
Remember that the
.Li $
must be escaped with a backslash character.
See also
.Sx Library directory Ns No .
.It Ev TECO_MEMORY
The value of this variable should be the name of a file
To be used for remembereing the name of the last file
edited by
.Nm .
The filename must be preceded by a
.Li $
character. Remember that the
.Li $
must be escaped with a backslash character.
See also
.Sx Filename memory Ns No .
.El
.Sh FILES
.Bl -tag
.It Pa %%DATADIR%%/*
Miscellaneous
.Nm
macros and commands.
.It Pa %%DOCSDIR%%/teco.doc
The
.Nm
manual (if installed).
.It Pa %%DOCSDIR%%/wchart.txt
Summary of
.Nm
keystrokes (if installed).
.El
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
A variety of documentation files may be installed in
.Pa %%DOCSDIR%% .
Apart from the ones mentioned in the
.Sx FILES
section, they are  of limited use, because they refer to
slightly different versions of
.Nm .
.Pp
There are also many online resources.
.Sh AUTHORS
.An "Pete Siemsen" Aq siemsen@usc.edu .
.br
.An "Tom Almy" Aq tomalmy@aracnet.com .
.br
FreeBSD port and manual page maintained by
.An "Bob Eager" Aq bob@eager.cx .
.Sh BUGS
There is no video mode.