irf@kuling.UUCP (Bo Thide) (01/26/88)
This is a very much improved version of 'lvi' - the learner's interface to vi(1). This is a "full release". The earlier version I posted some time ago was a test version with large portions of the help texts/tutorials missing. It also had a lousy documentation. However, it served its pupose of allowing people to try it and comment on it. Most of the comments I have received have been taken into account in this version. Note that with this release the vi card has been updated and may now even be correct :-) .. 'Lvi' 1.0 has been developed in HP-UX on an HP9000/540 and an HP 9000/350. During the development it has been partially tested on a VAX11/750 running 4.2BSD. If the 'showmode' flag is deleted it seems to run OK on the VAX too. (Assuming you have a correct termcap. My vt100 termcap on the VAX is not!) The shell archive contains ordinary text ("ASCII") files as well as vi(1) macro files with non-displayable ("non-ASCII") characters (<CTRL>-chars). The latter files have therefore been packed in a safe way. When you run the archive through sh(1) these files will be unpacked automatically by the included C program which will be compiled and moved to /tmp and, in the final stage of the unpacking, removed. This way you don't have to have access to 'btoa', 'uudecode' or any other specific unpacking program. Enjoy! Comments/corrections/suggestions to >>> Bo Thide', Swedish Institute of Space Physics, S-755 90 Uppsala, Sweden <<< Phone: (+46) 18-300020. Telex: 76036 (IRFUPP S). UUCP: ...enea!kuling!irfu!bt #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by bt at irfu on Tue Jan 26 01:50:53 1988 # # This archive contains: # README.lvi lvi.doc vi.help vi.card.tex # lvi lvi.map lvi.unm LVI # lvi.change lvi.cross lvi.delete lvi.init # lvi.insert lvi.open lvi.put lvi.quit # lvi.replace lvi.subst # echo x - README.lvi cat >README.lvi <<'@EOF' The 'lvi' package is for those who have no experience in editing with vi(1) and who may have used an editor/word processor only once or twice before. For those who are more familiar with screen editors, 'lvi' may be very boring. Possibly, 'nvi' is a better choice. 'Lvi' relies entirely on internal capabilities in vi(1) and is therefore quite slow and cannot cope with a user who types at a high speed. On the other hand, if you type one vi(1) command at a time and study the various texts that appear on your screen and try the examples given there you may gain a certain degree of proficiency in a rather short time. 'Lvi' uses such things as tags files and macros and may perhaps in itself be studied as a rather straightforward example of the power of vi(1). In its original form 'lvi' presupposes that the files 'lvi.map', 'lvi.unm', and 'vi.help' are moved to /usr/local/lib/vi and that the other 'lvi.*' files and the tags file 'LVI' are moved to /usr/local/lib/vi/tags. If you have another preference of where the files should be kept you have to edit 'lvi', 'lvi.map', and 'lvi.unmap' where, by necessity, absolute file addresses have been hard-coded in. >>> Bo Thide', Swedish Institute of Space Physics, S-755 90 Uppsala, Sweden <<< Phone: (+46) 18-300020. Telex: 76036 (IRFUPP S). UUCP: ...enea!kuling!irfu!bt @EOF chmod 444 README.lvi echo x - lvi.doc sed 's/^@//' >lvi.doc <<'@EOF' @@(#)lvi.doc 1.1 Documentation 88/01/25 23:20:34 LVI -- The Learner's introduction to VI by Bo Thide' Swedish Institute of Space Physics S-755 90 Uppsala, Sweden UUCP: ..enea!kuling!irfu!bt or bt@irfu.UUCP This is a macro package providing a learner's interface to the vi(1) editor family. You start by typing 'lvi <filename(s)>'. 'Lvi' will then create a specific EXINIT variable and run vi(1) through an exec(1) command. If available, the 'showmode' flag will be set in vi(1). When vi(1) has started a tags file containing an introductory text will be displayed. After that, just follow the instructions. 'Lvi' is adaptive in the sense that the first time you enter a command that in some way might change the text you are editing you will get interactive help with the command. You can even safely gain some experience by trying the command on the help text. Any text changes introduced at this stage will be silently discarded. After this exercise, you are supposed to be familiar with the particular command and will not get any special help the next time you use it. However, at any time you can type '^a' (<CTRL>a) to get assistance in form of an on-line, single-screen vi(1) help card containing virtually every standard vi(1) command. A TeX source file for this help card is made available so you can typeset it and keep it in your shirt pocket. The adaptiveness of 'lvi' has been accomplished by having all text-changing commands either ":map"ped away or ":map"ped to a ":ta" command that copies in a tags file with help text and examples. Only if you use a ":" command is it possible to damage the tags file. It does not seem to be possible to ":map" the ":" command itself to make 'lvi' completely safe. At least on the system (HP-UX) I used for developing 'lvi', such a mapping yields the message "Too dangerous to map that". After hitting '^c' you enter into the first of the files you want to edit. At the same time a help line is displayed at the bottom of the screen. This line also appears when you hit <CR> in command mode, something that unexperienced users tend to do now and then. Except for the fact that '^a', '^c', '<CR>', 'v', 'V', and 'q' are mapped to something useful, 'lvi' now behaves like standard vi(1). This means that you may in fact use 'lvi' to produce useful text files. @EOF chmod 444 lvi.doc echo x - vi.help sed 's/^@//' >vi.help <<'@EOF' PREPEND BY n TO REPEAT n TIMES. TYPE <ESC> TO RETURN FROM INPUT TO COMMAND MODE! a [A] append after cursor [line] w [W] word ["Word"] b [B] back one word ["Word"] x [X] cross out char at [before] cursor c [C] change next [to end of line] y [Y] yank next [whole line] d [D] delete next [to end of line] zpos redraw zone at pos (.,-, or CR) e [E] end of word ["Word"] ZZ write changes to file, exit 'vi' f [F] find next [previous] in line ^b[^f] backward [forward] paging G [nG] go to last [n:th] line in file ^d[^u] downward [upward] scrolling h [l] cursor left [right] ^d[^t] delete [tab] one sw during insert H [L] to home [last] line on screen ^e[^y] expose 1 more line at bottom [top] i [I] insert before cursor [line] ^h[^w] erase char [word] during insert j [k] cursor down [up] ~ change case (upper/lower) of char J join line with next line + [-] to first char in next [prev] line mx[`x] mark [return to] position 'x' 0 [$] to first [last] character in line M [n|] to middle line [n:th column] ; [,] repeat [reverse] last f,F,t, or T n [N] to next [previous] occurrence . repeat last change of the text o [O] open a line below [above] <<[>>] shift line one sw left [right] p [P] put in after [before] ( [)] to beginning of [next] sentence Q quit 'vi', go to 'ex' { [}] to beginning of [next] paragraph r [R] replace 1 [all] character[s] / [?] search forward [backward] s [S] substitute character [line] ``[''] return to previous position [line] t [T] to next [previous] in line : [:!] execute 'ex' [shell] command u [U] undo last change[s in line] ! [!!] shell command on next [this line] Type <ESC><ESC> and wait for the beep that says 'vi' is in command mode. Then a large variety of ':' commands are avilable e.g. the substitute command 's': :s/<pattern>/xx/<CR> change FIRST <pattern> in CURRENT LINE to 'xx' :s/<pattern>/xx/g<CR> change ALL <pattern>s in CURRENT LINE to 'xx' :%s/<pattern>/xx/g<CR> change ALL <pattern>s in ALL LINES to 'xx' :s/\(<pat1>\)\(<pat2>\)/\2xx\1/ change FIRST occurrence of <pat1><pat2> in CURRENT LINE to <pat2>'xx'<pat1>. :g/<pat1>/s/<pat2>$/xx/ ONLY in lines containing <pat1> change <pat2> to 'xx' ONLY AT THE END OF THE LINE. :.,+ns/^./xx/ change in CURRENT and FOLLOWING n lines ANY character at the BEGINNING of the line to 'xx' :%s/<pattern>/xx&yy/g change ALL <pattern>s in ALL lines to the combination 'xx'<pattern>'yy' :3s/<pattern>/\U& change 1ST <pattern> in 3RD LINE to <PATTERN> <pattern> means xx the string 'xx' [xy]xx the string 'xx' OR the string 'yx' [^y]xx the string 'zxx' where 'z' is any character EXCEPT 'y' x* the strings '', 'x', 'xx', 'xxx', ... Type 'u' to undo and '&' to repeat a substitution. @@(#)vi.help 1.1 88/01/25. Bo Thide', Swedish Institute of Space Physics. @EOF chmod 444 vi.help echo x - vi.card.tex cat >vi.card.tex <<'@EOF' %::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: % % @(#)vi.card.tex 1.1 TeX source 88/01/25 23:20:36 % % Run this through plain TeX % %::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: % % Author: % % Bo Thide\'e % Swedish Institute of Space Physics % S-755 90 Uppsala, Sweden % UUCP: ...enea!kuling!irfu!bt % %::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: % \nopagenumbers \magnification=\magstep0 \font\tt=cmtt12 \hsize 15 true cm \parindent=0pt \centerline{PREPEND ALL APPROPRIATE {\bf vi} COMMANDS BY {\it n} TO REPEAT {\it n} TIMES} \centerline{TYPE {\rm $\langle${\tt ESC}$\rangle$} TO RETURN FROM INPUT TO COMMAND MODE} \medskip \settabs\+{\tt m}{\it x} [{\tt `}{\it x\/}] \quad &{\tt s}ubstitute next [to end of line] \quad &{\tt <<} [{\tt >>}]\quad &{\tt e}xpose 1 more line at bottom [top]\cr \+{\tt a} [{\tt A}] &{\tt a}ppend after cursor [line] &{\tt w} [{\tt W}] &{\tt w}ord [``{\tt W}ord'']\cr \+{\tt b} [{\tt B}] &{\tt b}ack one word [``Word''] &{\tt x} [{\tt X}] &{\tt cross} out char at [before] cursor\cr \+{\tt c} [{\tt C}] &{\tt c}hange next [to end of line] &{\tt y} [{\tt Y}] &{\tt y}ank next [whole line]\cr \+{\tt d} [{\tt D}] &{\tt d}elete next [to end of line] &{\tt z}{\it pos} &redraw {\tt z}one at {\it pos} [{\tt .}, {\tt -}, or $\langle${\tt CR}$\rangle$]\cr \+{\tt e} [{\tt E}] &{\tt e}nd of word [``Word''] &{\tt ZZ} &exit {\bf vi}, write changes to file\cr \+{\tt f} [{\tt F}] &{\tt f}ind next [previous] in line &{\tt \^\/b}[{\tt \^\/f}] &{\tt b}ackward [{\tt f}orward] paging\cr \+{\tt G} [{\it n}{\tt G}] &{\tt G}o to last [{\it n\/}:th] line &{\tt \^\/d}[{\tt \^\/u}] &{\tt d}ownward [{\tt u}pward] scrolling\cr \+{\tt h} [{\tt l}] &cursor left [right] &{\tt \^\/d}[{\tt \^\/t}] &{\tt d}elete [{\tt t}ab] one {\it sw} during insert\cr \+{\tt H} [{\tt L}] &to {\tt H}ome [{\tt L}ast] line on screen &{\tt \^\/e}[{\tt \^\/y}] &{\tt e}xpose 1 more line at bottom [top]\cr \+{\tt i} [{\tt I}] &{\tt i}nsert before cursor [line] &{\tt \^\/h}[{\tt \^\/w}] &{\tt back} 1 char [{\tt w}ord] during insert\cr \+{\tt j} [{\tt k}] &cursor down [up] &{\tt \~~}&change case (upper/lower) of char\cr \+{\tt J} &{\tt J}oin line with next &{\tt +} [{\tt -}] &to first char in {\tt next} [{\tt prev}] line\cr \+{\tt m}{\it x} [{\tt `}{\it x\/}] &{\tt m}ark [return to] position {\it x} &{\tt 0} [{\tt \$}] &to {\tt first} [{\tt last}] character in line\cr \+{\tt M} [{\it n}{\tt |}]&to {\tt M}iddle line [{\it n\/}:th column] &{\tt ;} [{\tt ,}] &repeat [reverse] last {\tt f}, {\tt F}, {\tt t}, or {\tt T}\cr \+{\tt n} [{\tt N}] &to {\tt n}ext [previous] occurrence &{\tt .} &repeat last change of the text\cr \+{\tt o} [{\tt O}] &{\tt o}pen a line below [above] &{\tt <<} [{\tt >>}] &shift line one {\it sw} left [right]\cr \+{\tt p} [{\tt P}] &{\tt p}ut in after [before] &{\tt (} [{\tt )}] &to beginning of [next] sentence\cr \+{\tt Q} &{\tt Q}uit {\bf vi}, go to {\bf ex} &$\{$ [$\}$] &to beginning of [next] paragraph\cr \+{\tt r} [{\tt R}] &{\tt r}eplace 1 [all] character[s] &{\tt /} [{\tt ?}] &search forward [backward]\cr \+{\tt s} [{\tt S}] &{\tt s}ubstitute character [line] &{\tt `\/`} [{\tt '\/'}] &return to previous position [line]\cr \+{\tt t} [{\tt T}] &{\tt t}o next [previous] in line &{\tt :} [{\tt :!}] &execute {\bf ex} [shell] command\cr \+{\tt u} [{\tt U}] &{\tt u}ndo last change[s in line] &{\tt !} [{\tt !!}] &shell command on next [this line]\cr @EOF chmod 444 vi.card.tex echo Compiling unpacker for non-ascii files pwd=`pwd`; cd /tmp cat >unpack$$.c <<'EOF' #include <stdio.h> #define DEC(c) (((c) - ' ') & 077) main() { int n; char dest[128], a,b,c,d; scanf("begin %o ", &n); gets(dest); if (freopen(dest, "w", stdout) == NULL) { perror(dest); exit(1); } while ((n=getchar()) != EOF && (n=DEC(n))!=0) { while (n>0) { a = DEC(getchar()); b = DEC(getchar()); c = DEC(getchar()); d = DEC(getchar()); if (n-- > 0) putchar(a << 2 | b >> 4); if (n-- > 0) putchar(b << 4 | c >> 2); if (n-- > 0) putchar(c << 6 | d); } n=getchar(); } exit(0); } EOF cc -o unpack$$ unpack$$.c rm unpack$$.c cd $pwd echo x - lvi '[non-ascii]' /tmp/unpack$$ <<'@eof' begin 644 lvi M"B,Z.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ M.CHZ.CHZ.CHZ.CHZ.CHZ.@HC"B,@0"@C*6QV:2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N M97AP97)I96YC960@=FDH,2D@;&5A<FYE<BX*(@HB.CHZ.CHZ.CHZ.CHZ.CHZ M.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CH* M(@HB($%U=&AO<CH*(@HB(" @0F\@5&AI9&4G"B(@("!3=V5D:7-H($EN<W1I M='5T92!O9B!3<&%C92!0:'ES:6-S"B(@("!3+3<U-2 Y,"!5<'!S86QA+"!3 M=V5D96X*(B @(%550U Z("XN+F5N96$A:W5L:6YG(6ER9G4A8G0*(@HB.CHZ M.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ.CHZ M.CHZ.CHZ.CHZ.CH*(@HZ<V4@;F]R96%D;VYL>2!A=PHZ=6YM( ,*.FUA<" # M(#IR97<-.B)(:70@/$-44DP^82!F;W(@87-S:7-T86YC92X-"CIU;FT@2@HZ M=6YM(%$*.G5N;2!6"CIU;FT@(0HZ=6YM("X*.G5N;2 \"CIU;FT@/@HZ=6YM M('X*.G5N;2 ="CIU;FT@'@HZ=6YM( $*.FUA<" -(#HB16YT97(@/$-44DP^ M82!F;W(@87-S:7-T86YC90TK"CIM87 @ 2 Z(6-L96%R.VUO<F4@+W5S<B]L M;V-A;"]L:6(O=FDO=FDN:&5L<!L-"CIM87 A( $@&SHA8VQE87([;6]R92 O <=7-R+VQO8V%L+VQI8B]V:2]V:2YH96QP&PUA"@$@ end @eof chmod 444 lvi.unm echo x - LVI cat >LVI <<'@EOF' change /usr/local/lib/vi/tags/lvi.change 1 cross /usr/local/lib/vi/tags/lvi.cross 1 delete /usr/local/lib/vi/tags/lvi.delete 1 init /usr/local/lib/vi/tags/lvi.init 1 insert /usr/local/lib/vi/tags/lvi.insert 1 open /usr/local/lib/vi/tags/lvi.open 1 put /usr/local/lib/vi/tags/lvi.put 1 quit /usr/local/lib/vi/tags/lvi.quit 1 replace /usr/local/lib/vi/tags/lvi.replace 1 subst /usr/local/lib/vi/tags/lvi.subst 1 @EOF chmod 444 LVI echo x - lvi.change cat >lvi.change <<'@EOF' You have typed 'c' or 'C'. The one you typed is now activated. c is an operator that you put before a command that would normally move you to another position in order to change the text you pass over to the text that you input immediately after the command. End text insert with <ESC>. A '$' sign indicates how far the command will take effect. C is a shorthand for the 'c$' command that changes everything from the current cursor position to, but not including, the newline character. Use this text for harmless practicing. Undo last change with 'u'. Examples: c5wfive words<ESC> change next 5 words to the two words "five words". c}changing is easy change all text from the cursor to the end of the current paragraph to the text "changing is easy". c(--- change all text from the cursor to the beginning of the current sentence to the text "---". c/xyz<CR>New text change all text from the cursor to next occurrence of 'xyz' to the new text "New text". -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.change echo x - lvi.cross cat >lvi.cross <<'@EOF' You have typed 'x' or 'X'. The one you typed is now activated. x cross out (delete) the character at the cursor position. X cross out (delete) the character before the cursor position. Use this text for harmless practicing. Undo last change with 'u'. Examples: 5x cross out the character at the current cursor position and the 4 following characters. 5X cross out the 5 characters before the current cursor position. -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.cross echo x - lvi.delete cat >lvi.delete <<'@EOF' You have typed 'd' or 'D'. The one you typed is now activated. d is an operator that you put before a command that would normally move you to another position in order to delete the text you pass over. Deleted text is saved in one of buffers 1-9 or, if defined by '"', a-z. D is a shorthand for the 'd$' command that deletes everything from the current cursor position to, but not including, the newline character. dd deletes the current line completely. Use this text for harmless practicing. Undo last change with 'u'. Examples: d5w delete next 5 words. d} delete from the cursor to the end of the current paragraph. d( delete from the cursor to the beginning of the current sentence. d/xyz<CR> delete from the cursor to the next occurrence of 'xyz'. "ad9| delete to column 9. Save deleted text in named buffer 'a'. "x3dd delete 3 lines. Save the lines in the named buffer 'x'. -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.delete echo x - lvi.init cat >lvi.init <<'@EOF' > Welcome to 'lvi' - the learner's interface to the visual screen editor 'vi' < ------------------------------------------------------------------------------- At any point you get a list of all standard 'vi' commands by typing '^a' (=hold down <CTRL> and type 'a'). All of them can be used in 'lvi'. However, at this point all dangerous commands are inactive. Some will invoke a tutorial before they become active. Others will not become active until you start the editing of your file(s) by typing '^c'. Go ahead and try to find the active commands! This is perfectly safe unless you use a command starting with a ':' (colon). In addition to the standard 'vi' commands, the following special 'lvi' commands are available: ^a (<CTRL>-a) get Assistance. ^c (<CTRL>-c) Continue editing. v Visit the buffer you just left. Original text restored. q Quit. To get complete information on 'vi', type ':! man vi' (this may be very slow). -------------------------------------------------------------------bt 88/01/25 Type 'v' to visit old buffer, 'q' to quit, or any standard 'vi' command. @EOF chmod 444 lvi.init echo x - lvi.insert cat >lvi.insert <<'@EOF' You have typed 'i', 'a', 'I' or 'A'. The one you typed is now activated. i is a command for start inserting text before the current cursor position. a is a command for start appending text after the current cursor position. I is a shorthand for "^i", start inserting text before the first NON-BLANK CHARACTER in the current line. A is a shorthand for "$a", start appending text after the last character in the current line. Use this text for harmless practicing. End text insert/append by typing '<ESC>'. Undo last change with 'u'. Examples: 0i start inserting text in the first COLUMN of the current line. 67a-<ESC> append 67 '-'s and return to command mode (used in next line!). -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.insert echo x - lvi.open cat >lvi.open <<'@EOF' You have typed 'o' or 'O'. The one you typed is now activated. o open a new, empty line below the current line. Type in the text starting at colmun 1. End text input with <ESC>. O open a new, empty line above the current line. Type in the text starting at column 1. End text input with <ESC>. Use this text for harmless practicing. Undo last change with 'u'. -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.open echo x - lvi.put cat >lvi.put <<'@EOF' You have typed 'p' or 'P'. The one you typed is now activated. p put the content of the unnamed buffer 1 after the cursor position. "np put the content of the unnamed buffer n (1-9) after the cursor position. "xp put the content of the named buffer 'x' (a-z) after the cursor position. P put the content of the unnamed buffer 1 before the cursor position. "nP put the content of the unnamed buffer n (1-9) before the cursor position. "xP put the content of the named buffer 'x' (a-z) before the cursor position. Use this text for harmless practicing. Undo last change with 'u'. -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.put echo x - lvi.quit cat >lvi.quit <<'@EOF' OK you want to quit. Here are some ways to leave 'vi'. :q<CR> quit only if you have not changed anything. :q!<CR> quit WITHOUT recording any changes. Emergency exit. :wq<CR> or :x<CR> write whole buffer to the default file and exit. ZZ shorthand for ':wq<CR>' . 'ZZ' is the normal exit command. :i,jwq<CR> write lines i through j to the default file and exit. :.,+nwq<CR> write the current line and the following n lines to the default file and exit. -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. @EOF chmod 444 lvi.quit echo x - lvi.replace cat >lvi.replace <<'@EOF' You have typed 'r' or 'R'. The one you typed is now activated. r replace the character at the cursor position with the character that you input immediately after the command. R substitute the following text with the text you input immediately after the command. End text replacement with <ESC>. Use this text for harmless practicing. Undo last change with 'u'. Examples: rX replace the current character by the character 'X'. R5char replace the current and 4 following characters by "5char". -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.replace echo x - lvi.subst cat >lvi.subst <<'@EOF' You have typed 's' or 'S'. The one you typed is now activated. s substitute the character at the cursor position with the text that you input immediately after the command. End text insert with <ESC>. A '$' sign indicates how far the command will take effect. S substitute the text on the current line with new text. Use this text for harmless practicing. Undo last change with 'u'. Examples: schar<ESC> substitute the current character by the four characters "char". 3s5char<ESC> substitute the current and following 2 characters by the five characters "5char". 4Sfour lines substitute the current and following 3 lines by the single line containig the text "four lines". -------------------------------------------------------------------bt 88/01/25 Type '^c' to continue editing or 'v' to visit old buffer. Type 'q' to quit. @EOF chmod 444 lvi.subst rm /tmp/unpack$$ exit 0 -- >>> Bo Thide', Swedish Institute of Space Physics, S-755 90 Uppsala, Sweden <<< Phone (+46) 18-300020. Telex: 76036 (IRFUPP S). UUCP: ..enea!kuling!irfu!bt