In SEE ALSO, mark references to pkgsrc manual pages as such.
[dragonfly.git] / usr.bin / ee / ee.1
1 .\"
2 .\" $FreeBSD: src/usr.bin/ee/ee.1,v 1.8.2.6 2002/06/20 23:45:45 charnier Exp $
3 .\" $DragonFly: src/usr.bin/ee/ee.1,v 1.4 2008/01/26 15:14:41 swildner Exp $
4 .\"
5 .Dd August 30, 1995
6 .Dt EE 1
7 .Os
8 .Sh NAME
9 .Nm ee
10 .Nd easy editor
11 .Sh SYNOPSIS
12 .Nm
13 .Op Fl  eih
14 .Op +#
15 .Op Ar
16 .Nm ree
17 .Op Fl eih
18 .Op +#
19 .Op Ar
20 .Sh DESCRIPTION
21 The
22 .Nm
23 utility
24 is a simple screen oriented text editor.  It is always in text insertion
25 mode unless there is a prompt at the bottom of the terminal, or a
26 menu present (in a box in the middle of the terminal).  The
27 .Nm ree
28 utility is the same as
29 .Nm ,
30 but restricted to editing the named
31 file (no file operations, or shell escapes are allowed).
32 .Pp
33 For
34 .Nm
35 to work properly, the environment variable
36 .Ev TERM
37 must be set to indicate the type of terminal being used.  For
38 example, for an
39 .Tn HP 700/92
40 terminal, the
41 .Ev TERM
42 variable should be set to "70092".  See your System Administrator if
43 you need more information.
44 .Pp
45 The following options are available:
46 .Bl -tag -width indent
47 .It Fl e
48 Turn off expansion of tab character to spaces.
49 .It Fl i
50 Turn off display of information window at top of terminal.
51 .It Fl h
52 Turn off highlighting of borders of windows and menus (improves
53 performance on some terminals).
54 .It Sy +#
55 Move the cursor to line '#' at startup.
56 .El
57 .Ss "Control keys"
58 To do anything other than insert text, the user must use the control
59 keys (the
60 .Li Control
61 key, represented by a "^",  pressed in conjunction with an
62 alphabetic key, e.g., ^a) and function keys available on the keyboard
63 (such as
64 .Em "Next Page" ,
65 .Em "Prev Page" ,
66 arrow keys, etc.).
67 .Pp
68 Since not all terminals have function keys,
69 .Nm
70 has the basic cursor movement functions assigned to control keys as
71 well as more intuitive keys on the keyboard when available.  For
72 instance, to move the cursor up, the user can use the up arrow key,
73 or
74 .Em ^u .
75 .Bl -tag -width indent
76 .It ^a
77 Prompt for the decimal value of a character to insert.
78 .It ^b
79 Move to the bottom of the text.
80 .It ^c
81 Get the prompt for a command.
82 .It ^d
83 Move the cursor down.
84 .It ^e
85 Prompt for the string to search for.
86 .It ^f
87 Undelete the last deleted character.
88 .It ^g
89 Move to the beginning of the line.
90 .It ^h
91 Backspace.
92 .It ^i
93 Tab.
94 .It ^j
95 Insert a newline.
96 .It ^k
97 Delete the character the cursor is sitting on.
98 .It ^l
99 Move the cursor left.
100 .It ^m
101 Insert a newline.
102 .It ^n
103 Move to the next page.
104 .It ^o
105 Move to the end of the line.
106 .It ^p
107 Move to the previous page.
108 .It ^r
109 Move the cursor to the right.
110 .It ^t
111 Move to the top of the text.
112 .It ^u
113 Move the cursor up.
114 .It ^v
115 Undelete the last deleted word.
116 .It ^w
117 Delete the word beginning at the cursor position.
118 .It ^x
119 Search.
120 .It ^y
121 Delete from the cursor position to the end of line.
122 .It ^z
123 Undelete the last deleted line.
124 .It ^[ (ESC)
125 Pop up menu.
126 .El
127 .Ss "EMACS keys mode"
128 Since many shells provide an Emacs mode (for cursor movement and other editing
129 operations), some bindings that may be more useful for people familiar with
130 those bindings have been provided.  These are accessible via the
131 .Em settings
132 menu, or via the initialization file (see below).  The mappings are as follows:
133 .Bl -tag -width indent
134 .It ^a
135 Move to the beginning of the line.
136 .It ^b
137 Back 1 character.
138 .It ^c
139 Command prompt.
140 .It ^d
141 Delete character the cursor is sitting on.
142 .It ^e
143 End of line.
144 .It ^f
145 Forward 1 character.
146 .It ^g
147 Go back 1 page.
148 .It ^h
149 Backspace.
150 .It ^i
151 Tab.
152 .It ^j
153 Undelete last deleted character.
154 .It ^k
155 Delete line.
156 .It ^l
157 Undelete last deleted line.
158 .It ^m
159 Insert a newline.
160 .It ^n
161 Move to the next line.
162 .It ^o
163 Prompt for the decimal value of a character to insert.
164 .It ^p
165 Previous line.
166 .It ^r
167 Restore last deleted word.
168 .It ^t
169 Move to the top of the text.
170 .It ^u
171 Move to the bottom of the text.
172 .It ^v
173 Move to the next page.
174 .It ^w
175 Delete the word beginning at the cursor position.
176 .It ^y
177 Prompt for the string to search for.
178 .It ^z
179 Next word.
180 .It ^[ (ESC)
181 Pop up menu.
182 .El
183 .Ss "Function Keys"
184 .Bl -tag -width indent
185 .It Next Page
186 Move to the next page.
187 .It Prev Page
188 Move to the previous page.
189 .It Delete Char
190 Delete the character the cursor is on.
191 .It Delete Line
192 Delete from the cursor to the end of line.
193 .It Insert line
194 Insert a newline at the cursor position.
195 .It Arrow keys
196 Move the cursor in the direction indicated.
197 .El
198 .Ss Commands
199 Some operations require more information than a single keystroke can
200 provide.  For the most basic operations, there is a menu that can be
201 obtained by pressing the
202 .Tn ESC
203 key.  The same operations, and more can be performed by obtaining the
204 command prompt (^c) and typing in one of the commands below.
205 .Bl -tag -width indent
206 .It ! Ns Ar cmd
207 Execute
208 .Ar cmd
209 in a shell.
210 .It 0-9
211 Move to the line indicated.
212 .It case
213 Make searches case sensitive.
214 .It character
215 Display the ASCII value of the character at the cursor.
216 .It exit
217 Save the edited text, and leave the editor.
218 .It expand
219 Expand tabs to spaces.
220 .It file
221 Print the name of the file.
222 .It help
223 Display help screen.
224 .It line
225 Display the current line number.
226 .It nocase
227 Make searches insensitive to case (the default).
228 .It noexpand
229 Don't expand tab to spaces when the TAB key is pressed.
230 .It quit
231 Leave the editor without saving changes.
232 .It read Ar file
233 Read the named
234 .Ar file .
235 .It write Ar file
236 Write the text to the named
237 .Ar file .
238 .El
239 .Ss "Menu Operations"
240 Pop-up menus can be obtained by pressing the
241 .Em escape
242 key (or
243 .Em ^[
244 if no
245 .Em escape
246 key is present).  When in the menu, the escape key can be
247 used to leave the menu without performing any operations.  Use the up and
248 down arrow keys, or
249 .Em ^u
250 for moving up and
251 .Em ^d
252 for moving down to move to the desired items in the menu, then press
253 .Em return
254 to perform the indicated task.
255 .Pp
256 To the left of each menu item is a letter, which if the corresponding
257 letter is pressed on the keyboard selects that menu entry.
258 .Pp
259 The main menu in
260 .Nm
261 is as follows:
262 .Bl -tag -width indent
263 .It leave editor
264 If changes have been made, the user will get a menu prompting whether or
265 not the changes should be saved.
266 .It help
267 Display a help screen, with all of the keyboard operations and commands.
268 .It file operations
269 Pop up a menu for selecting whether to read a file, write to a file, or
270 save the current contents of the editor, as well as send the contents of
271 the editor to a print command (see the section
272 .Sx "Initializing ee from a file" ) .
273 .It redraw screen
274 Provide a means to repaint the screen if the screen has been corrupted.
275 .It settings
276 Show the current values of the operating modes, and right margin.  By
277 pressing return when the cursor is on a particular item, the value can be
278 changed.  To leave this menu, press the
279 .Em escape
280 key. (See
281 .Sx Modes
282 below.)
283 .It search
284 Pop up a menu in which the user may choose to enter a string to search
285 for, or search for a string already entered.
286 .It miscellaneous
287 Pop up a menu that allows the user to format the current paragraph,
288 execute a shell command, or check the spelling of the text in the editor.
289 .El
290 .Ss "Paragraph Formatting"
291 Paragraphs are defined for
292 .Nm
293 by a block of text bounded by:
294 .Bl -bullet -width indent
295 .It
296 Begin or end of file.
297 .It
298 Line with no characters, or only spaces and/or tabs.
299 .It
300 Line starting with a period ('.') or right angle bracket ('>').
301 .El
302 .Pp
303 A paragraph may be formatted two ways:  explicitly by choosing the
304 .Em format paragraph
305 menu item, or by setting
306 .Nm
307 to automatically
308 format paragraphs.  The automatic mode may be set via a menu, or via the
309 initialization file.
310 .Pp
311 There are three states for text operation in
312 .Nm :
313 free-form, margins,
314 and automatic formatting.
315 .Pp
316 "Free-form" is best used for things like programming.  There are no
317 restrictions on the length of lines, and no formatting takes place.
318 .Pp
319 "Margins" allows the user to type in text without having to worry about going
320 beyond the right margin (the right margin may be set in the
321 .Em settings
322 menu, the default is for the margin to be the right edge of the
323 terminal).  This is the mode that allows the
324 .Em format paragraph
325 menu item to work.
326 .Pp
327 "Automatic formatting" provides word-processor-like behavior.  The user
328 may type in text, while
329 .Nm
330 will make sure the entire paragraph fits
331 within the width of the terminal every time the user inserts a space after
332 typing or deleting text.  Margin observation must also be enabled in order for
333 automatic formatting to occur.
334 .Ss Modes
335 Although
336 .Nm
337 is a 'modeless' editor (it is in text insertion mode all the
338 time), there are modes in some of the things it does.  These include:
339 .Bl -tag -width indent
340 .It tab expansion
341 Tabs may be inserted as a single tab character, or replaced with spaces.
342 .It case sensitivity
343 The search operation can be sensitive to whether characters are upper- or
344 lower-case, or ignore case completely.
345 .It margins observed
346 Lines can either be truncated at the right margin, or extend on forever.
347 .It auto paragraph formatting
348 While typing in text, the editor can try to keep it looking reasonably well
349 within the width of the screen.
350 .It eightbit characters
351 Toggle whether eight bit characters are displayed as their value in angle
352 brackets (e.g. "<220>") or as a character.
353 .It info window
354 A window showing the keyboard operations that can be performed can be
355 displayed or not.
356 .It emacs keys
357 Control keys may be given bindings similar to emacs, or not.
358 .It 16 bit characters
359 Toggles whether sixteen bit characters are handled as one 16-bit quantities or
360 two 8-bit quantities.  This works primarily with the Chinese Big 5 code set.
361 .El
362 .Pp
363 You may set these modes via the initialization file (see below), or with a
364 menu (see above).
365 .Ss "Spell Checking"
366 There are two ways to have the spelling in the text checked from
367 .Nm .
368 One is by the traditional
369 .Xr spell 1
370 command, the other is with the
371 optional
372 .Xr ispell 1
373 command.
374 .Pp
375 Using
376 .Nm spell ,
377 the words that are not recognized will be placed at the top
378 of the file.  For the
379 .Nm ispell
380 option, the file is written to disk,
381 then
382 .Nm ispell
383 run on the file, and the file read back in once
384 .Nm ispell
385 has completed making changes to the file.
386 .Ss "Printing the contents of the editor"
387 The user may select a menu item which prints the contents of the editor.
388 The
389 .Nm
390 utility pipes the text in the editor to the command specified by the
391 initialization command
392 .Em printcommand
393 (see the section
394 .Sx Initializing ee from a file
395 below).  The default is to send the contents to
396 .Xr lp 1 .
397 .Pp
398 Whatever the user assigns to
399 .Em printcommand
400 must take input from
401 standard input.  See your system administrator for more details.
402 .Ss "Shell operations"
403 Shell commands can be executed from within
404 .Nm
405 by selecting the
406 .Em shell command
407 item in the
408 .Em miscellaneous
409 menu, or by placing an exclamation mark ("!") before the command to
410 execute at the
411 .Em command:
412 prompt.  Additionally, the user may direct the contents of the edit buffer
413 out to a shell operation (via a pipe) by using the left angle bracket
414 (">"), followed by a "!" and the shell command to execute.  The output of
415 a shell operation can also be directed into the edit buffer by using a
416 right angle bracket ("<") before the exclamation mark.  These can even be
417 used together to send output to a shell operation and read back the
418 results into the editor.  So, if the editor contained a list of words
419 to be sorted, they could be sorted by typing the following at the command
420 prompt:
421 .Dl ><!sort
422 This would send the contents of the editor to be piped into the
423 .Xr sort 1
424 utility and the result would be placed into the edit buffer at the current
425 cursor location.  The old information would have to be deleted by the user.
426 .Ss "Initializing ee from a file"
427 Since different users have different preferences,
428 .Nm
429 allows some
430 slight configurability.  There are three possible locations for an
431 initialization file for
432 .Nm :
433 the file
434 .Pa /usr/share/misc/init.ee ,
435 the file
436 .Pa .init.ee
437 in the user's home directory, or the file
438 .Pa .init.ee
439 in the current directory (if different from the home
440 directory).  This allows system administrators to set some preferences for
441 the users on a system-wide basis (for example, the
442 .Em print
443 command),
444 and the user to customize settings for particular directories (like one
445 for correspondence, and a different directory for programming).
446 .Pp
447 The file
448 .Pa /usr/share/misc/init.ee
449 is read first, then
450 .Pa $HOME/.init.ee ,
451 then
452 .Pa .init.ee ,
453 with the settings specified by the
454 most recent file read taking precedence.
455 .Pp
456 The following items may be entered in the initialization file:
457 .Bl -tag -width indent
458 .It case
459 Set searches to be case sensitive.
460 .It nocase
461 Set searches to be insensitive to case (default).
462 .It expand
463 Cause
464 .Nm
465 to expand tabs to spaces (default).
466 .It noexpand
467 Cause
468 .Nm
469 to insert tabs as a single character.
470 .It info
471 A small information window is displayed at the top of the terminal
472 (default).
473 .It noinfo
474 Turn off the display of the information window.
475 .It margins
476 Cause
477 .Nm
478 to truncate lines at the right margin when the
479 cursor passes beyond the right margin as set by the user
480 while text is being inserted
481 (default).
482 .It nomargins
483 Allow lines to extend beyond the right margin.
484 .It autoformat
485 Cause
486 .Nm
487 to automatically try to format the current paragraph while
488 text insertion is occurring.
489 .It noautoformat
490 Turn off automatic paragraph formatting (default).
491 .It printcommand
492 Allow the setting of the print command (default: "lp").
493 .It rightmargin
494 The user can select a value for the right margin (the first column on the
495 screen is zero).
496 .It highlight
497 Turn on highlighting of border of information window and menus (default).
498 .It nohighlight
499 Turn off highlighting of border of information window and menus.
500 .It eightbit
501 Turn on display of eight bit characters.
502 .It noeightbit
503 Turn off display of eight bit characters (they are displayed as their decimal
504 value inside angle brackets, e.g., "<220>").
505 .It 16bit
506 Turns on handling of 16-bit characters.
507 .It no16bit
508 Turns off handling of 16-bit characters.
509 .It emacs
510 Turns on emacs key bindings.
511 .It noemacs
512 Turns off emacs key bindings.
513 .El
514 .Ss "Save Editor Configuration"
515 When using this entry from the
516 .Em settings
517 menu, the user may choose to save the current configuration of
518 the editor (see
519 .Sx Initializing ee from a file
520 above) to a file named
521 .Pa .init.ee
522 in the current directory or the user's home directory.  If a file named
523 .Pa .init.ee
524 already exists, it will be renamed
525 .Pa .init.ee.old .
526 .Sh CAVEATS
527 THIS MATERIAL IS PROVIDED "AS IS".  THERE ARE
528 NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
529 MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
530 IMPLIED WARRANTIES OF MERCHANTABILITY AND
531 FITNESS FOR A PARTICULAR PURPOSE.  Neither
532 Hewlett-Packard nor Hugh Mahon shall be liable
533 for errors contained herein, nor for
534 incidental or consequential damages in
535 connection with the furnishing, performance or
536 use of this material.  Neither Hewlett-Packard
537 nor Hugh Mahon assumes any responsibility for
538 the use or reliability of this software or
539 documentation.  This software and
540 documentation is totally UNSUPPORTED.  There
541 is no support contract available.  Hewlett-Packard
542 has done NO Quality Assurance on ANY
543 of the program or documentation.  You may find
544 the quality of the materials inferior to
545 supported materials.
546 .Pp
547 Always make a copy of files that cannot be easily reproduced before
548 editing.  Save files early, and save often.
549 .Ss "International Code Set Support"
550 The
551 .Nm
552 utility supports single-byte character code sets (eight-bit clean), or the
553 Chinese Big-5 code set.  (Other multi-byte code sets may function, but the
554 reason Big-5 works is that a two-byte character also takes up two columns on
555 the screen.)
556 .Sh WARNINGS
557 The automatic paragraph formatting operation
558 may be too slow for slower systems.
559 .Sh FILES
560 .Bl -tag -width /usr/share/misc/init.ee -compact
561 .It Pa /usr/share/misc/init.ee
562 .It Pa $HOME/.init.ee
563 .It Pa .init.ee
564 .El
565 .Sh SEE ALSO
566 .Xr ispell 1 Pq Pa pkgsrc/textproc/ispell-base ,
567 .Xr lpr 1 ,
568 .Xr spell 1 ,
569 .Xr termcap 5 ,
570 .Xr terminfo 5 ,
571 .Xr environ 7
572 .Sh AUTHORS
573 The software
574 .Nm
575 was developed by
576 .An Hugh Mahon .
577 .Pp
578 This software and documentation contains
579 proprietary information which is protected by
580 copyright.  All rights are reserved.
581 .Pp
582 Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996 Hugh Mahon.