forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoc.sh
More file actions
executable file
·3314 lines (3314 loc) · 130 KB
/
Copy pathDoc.sh
File metadata and controls
executable file
·3314 lines (3314 loc) · 130 KB
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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
echo x - cflags.ms
sed '/^X/s///' > cflags.ms << '/'
X.Go 9 "CFLAGS"
X.PP
X\*E uses many preprocessor symbols to control compilation.
XSome of these control the sizes of buffers and such.
XThe "-DNO_XXXX" options remove small sets of related features.
X.PP
XMost \*E users will probably want to keep all features available.
XMinix-PC users, though, will have to sacrifice some sets because otherwise
X\*E would be too bulky to compile.
XThe "asld" phase of the compiler craps out.
X.IP "-DM_SYSV, -Dbsd, -DTOS, -DCOHERENT, -Damiga"
XThese flags tell the compiler that \*E is being compiled for
XSystem-V UNIX, BSD UNIX, Atari TOS, Coherent, or AmigaDos, respectively.
XFor other systems, the config.h file can generally figure it out automatically.
X.IP -DRAINBOW
XFor MS-DOS systems, this causes support for the DEC Rainbow to be compiled
Xinto \*E.
X.IP -DS5WINSIZE
XSome versions of SysV UNIX don't support support the "winsize"
Xstyle of screen-size testing,
Xso elvis ignores window size changes by default.
X.IP
XHowever, many of the newer SysV systems defines "winsize" in the
Xfile "/usr/include/sys/ptem.h".
XIf your SysV system has "winsize" then you should add
X-DS5SWINSIZE to the CFLAGS setting.
X.IP -DTERMIOS
XPOSIX is a SysV-derived specification which uses a terminal control
Xpackage called "termios", instead of "termio".
XSome other SysV systems may also use termios.
XYou can make elvis uses termios instead of the more common termio
Xby adding -DTERMIOS to CFLAGS.
X(Note: This hasn't been tested very well.)
X.IP -DNBUFS=\fInumber\fP
X\*E keeps most of your text in a temporary file;
Xonly a small amount is actually stored in RAM.
XThis flag allows you to control how much of the file can be in RAM at any time.
XThe default is 5 blocks, and the minimum is 3 blocks.
X(See the -DBLKSIZE flag, below.)
X.IP
XMore RAM allows global changes to happen a little faster.
X f you're just making many small changes in one section of a file, though,
Xextra RAM won't help much.
X.IP -DBLKSIZE=\fInumber\fP
XThis controls the size of blocks that \*E uses internally.
XThe value of BLKSIZE must be a power of two.
XEvery time you double BLKSIZE, you quadruple the size of a text file that
X\*E can handle, but you also cause the temporary file to grow faster.
XFor MS-DOS, Coherent, and Minix-PC, the default value is 1024, which allows
Xyou to edit files up to almost 512K bytes long.
XFor all other systems, the default value is 2048, which allows you to edit
Xfiles that are nearly 2 megabytes long.
X.IP
XThe BLKSIZE also determines the maximum line length, and a few other limits.
XBLKSIZE should be either 256, 512, 1024, or 2048.
XValues other than these can lead to strange behaviour.
X.IP -DTMPDIR=\fIstring\fP
XThis sets the default value of the "directory" option, which specifies where
Xthe temporary files should reside.
XThe value of TMPDIR must be a string, so be sure your value includes the
Xquote characters on each end.
X.IP "-DEXRC=\fIstr\fP, -DHMEXRC=\fIstr\fP, -DSYSEXRC=\fIstr\fP, -DEXINIT=\fIstr\fP"
XThis lets you control the names of the initialization files.
XTheir values must be strings, so be careful about quoting.
X.IP
XEXRC is the name of the initialization file in the current directory.
XIts default value is ".exrc" on UNIX systems -- the same as the real vi.
XSince that isn't a legal DOS filename, under DOS the default is "elvis.rc".
XFor other systems, check the config.h file.
X.IP
XHMEXRC is the name of the initialization file in your home directory.
XBy default, it is the same as EXRC.
X\*E will automatically prepend the name of your home directory to HMEXRC
Xat run time, so don't give a full path name.
X.IP
XSYSEXRC is the name of a system-wide initialization file.
XIt has no default value;
Xif you don't define a value for it, then
Xthe code that supports SYSEXRC just isn't compiled.
XThe value of SYSEXRC should be a full pathname, in quotes.
X.IP
XEXINIT is the name of an environment variable that can contain initialization
Xcommands.
XNormally, its value is "EXINIT".
X.IP -DKEYWORDPRG=\fIstring\fP
XThis flag determines the default value of the "keywordprg" option.
XIts value must be a string, so be careful about quoting.
XThe default value of this flag is "ref", which is a C reference program.
X.IP "-DCC_COMMAND=\fIstring\fP -DMAKE_COMMAND=\fIstring\fP -DERRLIST=\fIstring\fP"
XThese control the names of the C compiler, the "make" utility, and the
Xerror output file, respectively.
XThey are only used if -DNO_ERRLIST is not given.
X.IP
XThe default value of CC_COMMAND depends on the Operating System and compiler
Xthat you use to compile elvis;
Xfor UNIX, the default is "cc".
XThe default values of MAKE_COMMAND and ERRLIST are "make" and "errlist",
Xrespectively.
X.IP -DMAXRCLEN=\fInumber\fP
XThis determines how large a :@ macro command can be (measured in bytes).
XThe default is 1000 bytes.
XIf you increase this value significantly,
Xthen you may need to allocate extra memory for the stack.
XSee the "CHMEM" setting in the Makefile.
X.IP -DSHELL=\fIstring\fP
XThis is the default value of the "shell" option, and hence
Xthe default shell used from within \*E.
XThis only controls the default;
Xthe value you give here may be overridden at run-time by setting
Xan environment variable named SHELL (or COMSPEC for MS-DOS).
XIts value must be a string constant, so be careful about quoting.
X.IP -DTAGS=\fIstring\fP
XThis sets the name of the "tags" file,
Xwhich is used by the :tag command.
XIts value must be a string constant, so be careful about quoting.
X.IP "-DCS_IBMPC -DCS_LATIN1 -DCS_SPECIAL"
XThe digraph table and flipcase option will normally start out empty.
XHowever, if you add -DCS_IBMPC or -DCS_LATIN1 to your CFLAGS,
Xthen they will start out filled with values that are appropriate for the
XIBM PC character set or the ISO Latin-1 character set, respectively.
X.IP
XYou can also use -DCS_IBMPC and -DCS_SPECIAL together to get digraphs
Xthat produce the PC's graphic characters.
X.IP "-DDEBUG -DEBUG2"
X-DDEBUG adds the ":debug" and ":validate" commands,
Xand also adds many internal consistency checks.
XIt increases the size of the ".text" segment by about 6K.
X.IP
X-DDEBUG2 causes a line to be appended to a file called "debug.out"
Xeverytime any change is made to the edit buffer.
X.IP -DCRUNCH
XThis flag removes some non-critical code, so that \*E is smaller.
XFor example, it removes a short-cut from the regexp package, so that
Xtext searches are slower.
XAlso, screen updates are not as efficient.
XA couple of obscure features are disabled by this, too.
X.IP -DNO_MKEXRC
XThis removes the ":mkexrc" command,
Xso you have to create any .exrc files manually.
XThe size of the .text segment will be reduced by about 600 bytes.
X.IP -DNO_CHARATTR
XPermanently disables the charattr option.
XThis reduces the size of your ".text" segment by about 850 bytes.
X.IP -DNO_RECYCLE
XNormally, \*E will recycle space (from the temporary file) which contains
Xtotally obsolete text.
XThis flag disables this recycling.
XWithout recycling, the ".text" segment is about 1K smaller
Xthan it would otherwise be,
Xbut the tmp file grows much faster.
XIf you have a lot of free space on your hard disk,
Xbut \*E is too bulky to run with recycling,
Xthen try it without recycling.
X.IP
XWhen using a version of \*E that has been compiled with -DNO_RECYCLE,
Xyou should be careful to avoid making many small changes to a file
Xbecause each individual change will cause the tmp file to grow by at least 1k.
XHitting "x" thirty times counts as thirty changes,
Xbut typing "30x" counts as one change.
XAlso, you should occasionally do a ":w" followed by a ":e" to start with a
Xfresh tmp file.
X.IP
XInterestingly, the real vi never recycles space from its temporary file.
X.IP -DNO_SENTENCE
XLeaves out the "(" and ")" visual mode commands.
XAlso, the "[[", "]]", "{", and "}" commands will not recognize *roff macros.
XThe sections and paragraphs options go away.
XThis saves about 650 bytes in the ".text" segment.
X.IP -DNO_CHARSEARCH
XLeaves out the visual commands which locate a given character
Xin the current line:
X"f", "t", "F", "T", "," and ";".
XThis saves about 900 bytes.
X.IP -DNO_EXTENSIONS
XLeaves out the "K" and "#" visual commands.
XAlso, the arrow keys will no longer work in input mode.
XRegular expressions will no longer recognize the \\{\\} operator.
X(Other extensions are either inherent in the design of \*E,
Xor are controlled by more specific flags,
Xor are too tiny to be worth removing.)
XThis saves about 250 bytes.
X.IP -DNO_MAGIC
XPermanently disables the "magic" option, so that most meta-characters
Xin a regular expression are *NOT* recognized.
XThis saves about 3k of space in the ".text" segment, because
Xthe complex regular expression code can be replaced by much simpler code.
X.IP -DNO_SHOWMODE
XPermanently disables the "showmode" option, saving about 250 bytes.
X.IP -DNO_CURSORSHAPE
XNormally, \*E tries to adjust the shape of the cursor as a reminder
Xof which mode you're in.
XThe -DNO_CURSORSHAPE flag disables this, saving about 150 bytes.
X.IP -DNO_DIGRAPH
XTo allow entry of non-ASCII characters, \*E supports digraphs.
XA digraph is a single (non-ASCII) character which is entered as a
Xcombination of two other (ASCII) characters.
XIf you don't need to input non-ASCII characters,
Xor if your keyboard supports a better way of entering non-ASCII characters,
Xthen you can disable the digraph code and save about 450 bytes.
X.IP -DNO_ERRLIST
X\*E adds a ":errlist" command, which is useful to programmers.
XIf you don't need this feature, you can disable it via the -DNO_ERRLIST flag.
XThis will reduce the .text segment by about 900 bytes, and the .bss segment
Xby about 300 bytes.
X.IP -DNO_ABBR
XThe -DNO_ABBR flag disables the ":abbr" command,
Xand reduces the size of \*E by about 250 bytes.
X.IP -DNO_OPTCOLS
XWhen \*E displays the current options settings via the ":set" command,
Xthe options are normally sorted into columns.
XThe -DNO_OPTCOLS flag causes the options to be sorted across the rows,
Xwhich is much simpler for the computer.
XThe -DNO_OPTCOLS flag will reduce the size of your .text segment by about
X500 bytes.
X.IP -DNO_MODELINES
XThis removes all support for modelines.
X.IP -DNO_TAG
XThis disables tag lookup.
XIt reduces the size of the .text segment by about 750 bytes.
X.IP "-DNO_ALT_FKEY -DNO_CTRL_FKEY -DNO_SHIFT_FKEY -DNO_FKEY"
XThese remove explicit support of function keys.
X-DNO_ALT_FKEY removes support for the <alternate> versions function keys.
X-DNO_CTRL_FKEY removes support for the <control> and <alternate> versions function keys.
X-DNO_SHIFT_FKEY removes support for the <shift>, <control>, and <alternate> versions function keys.
X-DNO_FKEY removes all support of function keys.
X.IP
X\*E's ":map" command normally allows you to use the special sequence "#<n>"
Xto map function key <n>.
XFor example, ":map #1 {!}fmt^M" will cause the <F1> key to reformat a paragraph.
X\*E checks the :k1=: field in the termcap description of your terminal
Xto figure out what code is sent by the <F1> key.
XThis is handy because it allows you to create a .exrc file which maps function
Xkeys the same way regardless of what type of terminal you use.
X.IP
XThat behaviour is standard; most implementations of the real vi supports it too.
X\*E extends this to allow you to use "#1s" to refer to <shift>+<F1>,
X"#1c" to refer to <control>+<F1>, and
X"#1a" to refer to <alt>+<F1>.
XThe termcap description for the terminal should have fields named
X:s1=:c1=:a1=: respectively, to define the code sent by these key conbinations.
X(You should also have :k2=:s2=:c2=:a2=: for the <F2> key, and so on.)
X.IP
XBut there may be problems.
XThe terminfo database doesn't support :s1=:c1=:a1=:, so no terminfo terminal
Xdescription could ever support shift/control/alt function keys;
Xso you might as well add -DNO_SHIFT_FKEY to CFLAGS if you're using terminfo.
X.IP
XNote that, even if you have -DNO_FKEYS, you can still configure \*E to use
Xyour function keys my mapping the literal character codes sent by the key.
XYou just couldn't do it in a terminal-independent way.
XTERM_925
X.IP "-DTERM_AMIGA -DTERM_VT100 -DTERM_VT52 etc."
XThe tinytcap.c file contains descriptions of several terminal types.
XFor each system that uses tinytcap, a reasonable subset of the available
Xdescriptions is actually compiled into \*E.
XIf you wish to enlarge this subset, then you can add the appropriate -DTERM_XXX
Xflag to your CFLAGS settings.
X.IP
XFor a list of the available terminal types, check the tinytcap.c file.
X.IP -DINTERNAL_TAGS
XNormally, \*E uses the "ref" program to perform tag lookup.
XThis is more powerful than the real vi's tag lookup,
Xbut it can be much slower.
X.IP
XIf you add -DINTERNAL_TAGS to your CFLAGS setting,
Xthen \* will use its own internal tag lookup code, which is faster.
X.IP -DPRSVDIR=\fIdirectory\fR
XThis controls where preserved files will be placed.
XAn appropriate default has been chosen for each Operating System,
Xso you probably don't need to worry about it.
X.IP -DFILEPERMS=\fInumber\fR
XThis affects the attributes of files that are created by \*E;
Xit is used as the second argument to the creat() function.
XThe default is 0666 which (on UNIX systems at least) means that
Xanybody can read or write the new file, but nobody can execute it.
XOn UNIX systems, the creat() call modifies this via the umask setting.
X.IP -DKEYBUFSIZE=\fInumber\fR
XThis determines the size of the type-ahead buffer that elvis uses.
XIt also limits the size of keymaps that it can handle.
XThe default is 1000 characters, which should be plenty.
/
echo x - cutbufs.ms
sed '/^X/s///' > cutbufs.ms << '/'
X.Go 6 "CUT BUFFERS"
X.PP
XWhen \*E deletes text, it stores that text in a cut buffer.
XThis happens in both visual mode and EX mode.
XThere is no practical limit to how much text a cut buffer can hold.
X.PP
XThere are 36 cut buffers:
X26 named buffers ("a through "z),
X9 anonymous buffers ("1 through "9),
Xand 1 extra cut buffer (".).
X.PP
XIn EX mode, the :move and :copy commands use a cut buffer to temporarily
Xhold the text to be moved/copied.
X.NH 2
XPutting text into a Cut Buffer
X.PP
XIn visual mode, text is copied into a cut buffer when you use the
Xd, y, c, C, s, or x commands.
XThere are also a few others.
X.PP
XBy default, the text goes into the "1 buffer.
XThe text that used to be in "1 gets shifted into "2,
X"2 gets shifted into "3, and so on.
XThe text that used to be in "9 is lost.
XThis way, the last 9 things you deleted are still accessible.
X.PP
XYou can also put the text into a named buffer -- "a through "z.
XTo do this, you should type the buffer's name
X(two keystrokes: a double-quote and a lowercase letter)
Xbefore the command that will cut the text.
XWhen you do this, "1 through "9 are not affected by the cut.
X.PP
XYou can append text to one of the named buffers.
XTo do this, type the buffer's name in uppercase
X(a double-quote and an uppercase letter)
Xbefore the d/y/c/C/s/x command.
X.PP
XThe ". buffer is special.
XIt isn't affected by the d/y/c/C/s/x command.
XInstead, it stores the text that you typed in
Xthe last time you were in input mode.
XIt is used to implement the . visual command,
Xand ^A in input mode.
X.PP
XIn EX mode (also known as colon mode),
Xthe :delete, :change, and :yank commands all copy text into a cut buffer.
XLike the visual commands, these EX commands normally use the "1 buffer,
Xbut you can use one of the named buffers by giving its name after the command.
XFor example,
X.sp 1
X.ti +0.5i
X:20,30y a
X.sp
X.LP
Xwill copy lines 20 through 30 into cut buffer "a.
X.PP
XYou can't directly put text into the ". buffer, or the "2 through "9 buffers.
X.NH 2
XPasting from a Cut Buffer
X.PP
XThere are two styles of pasting:
Xline-mode and character-mode.
XIf a cut buffer contains whole lines (from a command like "dd")
Xthen line-mode pasting is used;
Xif it contains partial lines (from a command like "dw")
Xthen character-mode pasting is used.
XThe EX commands always cut whole lines.
X.PP
XCharacter-mode pasting causes the text to be inserted into the line that
Xthe cursor is on.
X.PP
XLine-mode pasting inserts the text on a new line above or below the line
Xthat the cursor is on.
XIt doesn't affect the cursor's line at all.
X.PP
XIn visual mode, the p and P commands insert text from a cut buffer.
XUppercase P will insert it before the cursor,
Xand lowercase p will insert it after the cursor.
XNormally, these commands will paste from the "1 buffer, but you can
Xspecify any other buffer to paste from.
XJust type its name (a double-quote and another character)
Xbefore you type the P or p.
X.PP
XIn EX mode, the (pu)t command pastes text after a given line.
XTo paste from a buffer other that "1,
Xenter its name after the command.
X.NH 2
XMacros
X.PP
XThe contents of a named cut buffer can be executed as a series of
Xex/vi commands.
X.PP
XTo put the instructions into the cut buffer, you must first insert
Xthem into the file, and then delete them into a named cut buffer.
X.PP
XTo execute a cut buffer's contents as EX commands,
Xyou should give the EX command "@" and the name of the buffer.
XFor example, :@z will execute "z as a series of EX commands.
X.PP
XTo execute a cut buffer's contents as visual commands,
Xyou should give the visual command "@" and the letter of the buffer's name.
XThe visual "@" command is different from the EX "@" command.
XThey interpret the cut buffer's contents differently.
X.PP
XThe visual @ command can be rather finicky.
XEach character in the buffer is interpretted as a keystroke.
XIf you load the instructions into the cut buffer via a "zdd command,
Xthen the newline character at the end of the line will be executed just
Xlike any other character, so the cursor would be moved down 1 line.
XIf you don't want the cursor to move down 1 line at the end of each
X@z command, then you should load the cut buffer by saying 0"zD instead.
X.PP
XAlthough cut buffers can hold any amount of text,
X\*E can only \fIexecute\fR small buffers.
XThe size limit is roughly 1000 characters, for either EX macros or VI macros.
XIf a buffer is too large to execute, an error message is displayed.
X.PP
XYou can't nest :@ commands.
XYou can't run :@ commands from your .exrc file,
Xor any other :source file either.
XSimilarly, you can't run a :source command from within an @ command.
XHopefully, these restrictions will be lifted in a later version.
X.NH 2
XThe Effect of Switching Files
X.PP
XWhen \*E first starts up, all cut buffers are empty.
XWhen you switch to a different file
X(via the :n or :e commands perhaps)
Xthe 9 anonymous cut buffers are emptied again,
Xbut the other 27 buffers ("a through "z, and ".) retain their text.
/
echo x - differ.ms
sed '/^X/s///' > differ.ms << '/'
X.Go 7 "DIFFERENCES BETWEEN \*E & BSD VI/EX"
X.PP
X\*E is not 100% compatible with the real vi/ex.
X\*E has many small extensions, some omissions, and a few features which
Xare implemented in a slightly different manner.
X.NH 2
XExtensions
X.IP "Save Configuration" 1i
XThe :mkexrc command saves the current :set and :map configurations in
Xthe ".exrc" file in your current directory.
X.IP "Previous File" 1i
XThe :N or :prev command moves backwards through the args list.
X.IP "Center Current Row" 1i
XIn visual command mode, the (lowercase) "zz" command will center the current
Xline on the screen, like "z=".
X.IP "Changing Repeat Count" 1i
XThe default count value for . is the same as the previous command
Xwhich . is meant to repeat.
XHowever, you can supply a new count if you wish.
XFor example, after "3dw", "." will delete 3 words,
Xbut "5." will delete 5 words.
X.IP "Previous Text" 1i
XThe text which was most recently input
X(via a "cw" command, or something similar)
Xis saved in a cut buffer called ". (which
Xis a pretty hard name to write in an English sentence).
X.IP "Keyword Lookup" 1i
XIn visual command mode, you can move the cursor onto a word and press
Xshift-K to have \*E run a reference program to look that word up.
XThis command alone is worth the price of admission!
XSee the ctags and ref programs.
X.IP "Increment/Decrement" 1i
XIn visual command mode, you can move the cursor onto a number and
Xthen hit ## or #+ to increment that number by 1.
XTo increment it by a larger amount,
Xtype in the increment value before hitting the initial #.
XThe number can also be decremented or set by hitting #- or #=, respectively.
X.IP "Input Mode" 1i
XYou can backspace past the beginning of the line.
X.IP "" 1i
XThe arrow keys work in input mode.
X.IP "" 1i
XIf you type control-A, then the text that you input last time is inserted.
XYou will remain in input mode, so you can backspace over part of it,
Xor add more to it.
X(This is sort of like control-@ on the real vi,
Xexcept that control-A really works.)
X.IP "" 1i
XControl-P will insert the contents of the cut buffer.
X.IP "" 1i
XReal vi can only remember up to 128 characters of input,
Xbut \*E can remember any amount.
X.IP "" 1i
XThe ^T and ^D keys can adjust the indent of a line no matter where
Xthe cursor happens to be in that line.
X.IP "" 1i
XYou can save your file and exit \*E directly from input mode by hitting
Xcontrol-Z twice.
X.IP "" 1i
X\*E supports digraphs as a way to enter non-ASCII characters.
X.IP "Start in Input Mode" 1i
XIf you ":set inputmode" in your .exrc file, then \*E will start up in
Xinput mode instead of visual command mode.
X.IP "Visible Fonts" 1i
XWith ":set charattr", \*E can display "backslash-f" style character attributes on the
Xscreen as you edit.
XThe following example shows the recognized atributes:
X.sp
X.ti +0.5i
Xnormal \\fBboldface\\fR \\fIitalics\\fR \\fUunderlined\\fR normal
X.sp
XNOTE: you must compile \*E without the -DNO_CHARATTR flag for
Xthis to work.
X.IP "File Syncing" 1i
XAfter a crash, you can usually recover the altered form of the file
Xfrom the temporary file that \*E uses -- unless the temporary file was
Xcorrupted.
X.IP "" 1i
XUNIX systems use a delayed-write cache, which means that when \*E tries to
Xwrite to the temporary file, the information might still be in RAM instead
Xof on the disk.
XA power failure at that time would cause the in-RAM information to be lost.
XUNIX's sync() call will force all such information to disk.
X.IP "" 1i
XMS-DOS and Atari TOS don't write a file's length to disk until that file
Xis closed.
XConsequently, the temporary file would appear to be 0 bytes long if power
Xfailed when we were editing.
XTo avoid this problem, a sync() function has been written which will close
Xthe temporary file and then immediately reopen it.
X.IP "Cursor Shape" 1i
X\*E changes the shape of the cursor to indicate which mode you're in,
Xif your terminal's termcap entry includes the necessary capabilities.
X.IP "Hide nroff Lines" 1i
XTh ":set hideformat" option hides nroff format control lines.
X(They are displayed on the screen as blank lines.)
X.ne 7
X.IP "Compiler Interface" 1i
X\*E is clever enough to parse the error messages emitted by many compilers.
XTo use this feature,
Xyou should collect your compiler's error messages into a file called "errlist";
X\*E will read this file,
Xdetermine which source file caused the error messages,
Xstart editing that file,
Xmove the cursor to the line where the error was detected,
Xand display the error message on the status line.
XNifty!
X.IP "Visible Text Selection" 1i
XIn visual command mode, 'v' starts visibly selecting characters and
X\&'V' starts visibly selecting whole lines.
XThe character or line where the cursor is located becomes one
Xendpoint of the selection.
XYou can then use the standard cursor movement commands to move the cursor
Xto the other endpoint, and then press one of the operator commands
X(c/d/y/</>/!/=/\\).
XThe operator will then immediately be applied to the selected text.
X.IP "Pop-up Menu Operator" 1i
XThe '\\' key is a new operator,
Xsimilar in operation to the c/d/y/</>/! operators
XIt conjures up a menu, from which you can select any of the other
Xoperators plus a few other common commands.
X.IP "Preset Filter Operator" 1i
XThe '=' key is another new operator.
XIt is similar to the '!' operator, except that while
X\&'!' asks you to type in a filter command each time,
X\&'=' assumes it should always run the command stored in the \fIequalprg\fR option.
X.IP "Move to a Given Percentage" 1i
XThe '%' movement key can now accept an optional count.
XWithout a count, the '%' key still moves to a matching parenthesis
Xlike it always did.
XWith a count somewhere between 1 and 100, though, it moves the cursor to
Xapproximately a given percentage of the way through the file.
XFor example, typing "50%" will move the cursor to the middle of the file.
X.IP "Regular Expressions"
XIn regular expressions, several new forms of closure operators are supported:
X\\{\fIn\fR}, \\{\fIn\fR,\fIm\fR}, \\+, and \\?.
X.NH 2
XOmissions
X.PP
XThe replace mode is a hack.
XIt doesn't save the text that it overwrites.
X.PP
XLong lines are displayed differently -- where the real vi would
Xwrap a long line onto several rows of the screen, \*E simply
Xdisplays part of the line, and allows you to scroll the screen
Xsideways to see the rest of it.
X.PP
XThe ":preserve" and ":recover" commands are missing.
XSo is the -r flag.
XI've never had a good reason to use ":preserve",
Xand since ":recover" is used so rarely
XI decided to implement it as a separate program.
XThere's no need to load the recovery code into memory every
Xtime you edit a file, I figured.
X.PP
XLISP support is missing.
XHowever, the = key is still an operator that reformats lines of text.
XBy default, it reformats lines by sending them through the \fIfmt\fP filter,
Xbut you could write your own LISP beautifier and configure elvis to use it.
XKey mappings could take care of most other differences.
XAuto-indent is the only thing that is irrecoverably lost.
X.PP
XAutoindent mode acts a little different from the real vi, anyway.
XIt doesn't handle ^^D or 0^D correctly.
XOn the other hand, it \fIdoes\fP allow ^D and ^T to be used anywhere in the
Xline, to adjust the indentation for the whole line.
/
echo x - environ.ms
sed '/^X/s///' > environ.ms << '/'
X.Go 11 "ENVIRONMENT VARIABLES"
X.PP
X\*E examines several environment variables when it starts up.
XThe values of these variables are used internally for a variety
Xof purposes.
XYou don't need to define all of these;
Xon most systems, \*E only requires TERM to be defined.
XOn AmigaDOS, MS-DOS or TOS systems, even that is optional.
X.SH
XTERM, TERMCAP
X.PP
XTERM tells \*E the name of the termcap entry to use.
XTERMCAP may contain either the entire termcap entry,
Xor the full pathname of the termcap file to search through.
X.PP
XIf your version of \*E is using tinytcap instead of the full termcap library,
Xthen the value of TERMCAP \fIcannot\fR contain any backslash escapes (\\E, \\r, etc.)
Xor carat escapes (^[, ^M, etc.), because tinytcap doesn't understand them.
XInstead, you should embed the actual control character into the string.
X.SH
XTMP, TEMP
X.PP
XThese only work for AmigaDOS, MS-DOS and Atari TOS.
XEither of these variables may be used to set the "directory" option,
Xwhich controls where temporary files are stored.
XIf you define them both, then TMP is used, and TEMP is ignored.
X.SH
XLINES, COLUMNS
X.PP
XThe termcap entry for your terminal should specify the size of your screen.
XIf you're using a windowing interface, then there is an ioctl() call which
Xwill provide the size of the window; the ioctl() values will override the
Xvalues in the termcap entry.
XThe LINES and COLUMNS environment variables (if defined)
Xwill override either of these sources.
XThey, in turn, can be overridden by a ":set" command.
X.PP
XNormally, the LINES and COLUMNS variables shouldn't need to be defined.
X.SH
XEXINIT
X.PP
XThis variable's value may contain one or more colon-mode commands,
Xwhich will be executed after all of the ".exrc" files
Xbut before interactive editing begins.
X.PP
XTo put more than one command in EXINIT, you can separate the commands
Xwith either a newline or a '|' character.
X.SH
XSHELL, COMSPEC
X.PP
XYou can use COMSPEC in MS-DOS, or SHELL in any other system,
Xto specify which shell should be used for executing commands and
Xexpanding wildcards.
X.SH
XHOME
X.PP
XThis variable should give the full pathname of your home directory.
X\*E needs to know the name of your home directory so it can locate
Xthe ".exrc" file there.
X.SH
XTAGPATH
X.PP
XThis variable is used by the "ref" program.
XIt contains a list of directories that might contain a relevent "tags" file.
XUnder AmigaDOS, MS-DOS or Atari TOS, the names of the directories should be separated by
Xsemicolons (";").
XUnder other operating systems, the names should be separated by colons (":").
X.PP
XIf you don't define TAGPATH, then "ref" will use a default list which includes
Xthe current directory and a few other likely places.
XSee the definition of DEFTAGPATH at the start of ref.c for an accurate list.
/
echo x - ex.ms
sed '/^X/s///' > ex.ms << '/'
X.Go 3 "COLON MODE COMMANDS"
X.ID
X.ps
X.in 0.8i
X.ta 2i 3.i
X.\" NOTE: The following macro is used to output a single line of the
X.\" command chart. Its usage is:
X.\"
X.\" .Cm <linespecs> <name> <arguments>...
X.\"
X.de Cm
X.if "\\$1"0" \t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
X.if "\\$1"1" \s-2[line]\s+2\t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
X.if "\\$1"2" \s-2[line][,line]\s+2\t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
X..
X.if t .ds Q ``
X.if t .ds U ''
X.if n .ds Q "
X.if n .ds U "
X\s+2LINES COMMAND ARGUMENTS\s-2
X.Cm 0 ab[br] [short] [expanded form]
X.Cm 1 a[ppend][!]
X.Cm 0 ar[gs] [files]
X.Cm 0 cc [files]
X.Cm 0 cd[!] [directory]
X.Cm 2 c[hange]
X.Cm 0 chd[ir][!] [directory]
X.Cm 2 co[py] line
X.Cm 0 col[or] [when] [[\*Qlight\*U] color] [\*Qon\*U color]
X.Cm 2 d[elete] [\*Ux]
X.Cm 0 dig[raph][!] [XX [Y]]
X.Cm 0 e[dit][!] [file]
X.Cm 0 er[rlist][!] [errlist]
X.Cm 0 f[ile] [file]
X.Cm 2 g[lobal] /regexp/ command
X.Cm 1 i[nsert]
X.Cm 2 j[oin][!]
X.Cm 2 l[ist]
X.Cm 0 mak[e] [target]
X.Cm 0 map[!] key mapped_to
X.Cm 1 ma[rk] \*Ux
X.Cm 0 mk[exrc]
X.Cm 2 m[ove] line
X.Cm 0 n[ext][!] [files]
X.Cm 0 N[ext][!]
X.Cm 2 nu[mber]
X.Cm 2 p[rint]
X.Cm 1 pu[t] [\*Ux]
X.Cm 0 q[uit][!]
X.Cm 1 r[ead] file
X.Cm 0 rew[ind][!]
X.Cm 0 se[t] [options]
X.Cm 0 so[urce] file
X.Cm 2 s[ubstitute] /regexp/replacement/[p][g][c]
X.Cm 0 ta[g][!] tagname
X.Cm 0 una[bbr] [short]
X.Cm 0 u[ndo]
X.Cm 0 unm[ap][!] key
X.Cm 0 ve[rsion]
X.Cm 2 v[global] /regexp/ command
X.Cm 0 vi[sual] [filename]
X.Cm 0 wq
X.Cm 2 w[rite][!] [[>>]file]
X.Cm 0 x[it][!]
X.Cm 2 y[ank] [\*Ux]
X.Cm 2 ! command
X.Cm 2 <
X.Cm 2 =
X.Cm 2 >
X.Cm 2 &
X.Cm 0 @ "" \*Ux
X.DE
X.TA
X.PP
XTo use colon mode commands, you must switch from visual command
Xmode to colon command mode.
XThe visual mode commands to do this are ":" for a single colon command,
Xor "Q" for many colon mode commands.
X.NH 2
XLine Specifiers
X.PP
XLine specifiers are always optional.
XThe first line specifier of most commands usually defaults to the current line.
XThe second line specifier usually defaults to be the same
Xas the first line specifier.
XExceptions are :write, :global, and :vglobal, which act on all lines of the
Xfile by default, and :!, which acts on no lines by default.
X.PP
XLine specifiers consist of an absolute part and a relative part.
XThe absolute part of a line specifier may be either an explicit line number,
Xa mark, a dot to denote the current line, a dollar sign to denote the last
Xline of the file, or a forward or backward search.
X.PP
XAn explicit line number is simply a decimal number, expressed as a
Xstring of digits.
X.PP
XA mark is typed in as an apostrophe followed by a letter.
XMarks must be set before they can be used.
XYou can set a mark in visual command mode by typing "m" and a letter,
Xor you can set it in colon command mode via the "mark" command.
X.PP
XA forward search is typed in as a regular expression surrounded by
Xslash characters; searching begins at the default line.
XA backward search is typed in as a regular expression surrounded by
Xquestion marks; searching begins at the line before the default line.
X.PP
XIf you omit the absolute part, then the default line is used.
X.PP
XThe relative part of a line specifier is typed as a "+" or "-" character
Xfollowed by a decimal number.
XThe number is added to or subtracted from the absolute part
Xof the line specifier to produce the final line number.
X.PP
XAs a special case, the % character may be used to specify all lines of the file.
XIt is roughly equivelent to saying 1,$.
XThis can be a handy shortcut.
X.PP
XSome examples:
X.LD
X.ps
X.ta 0.5i 1.8i
X :p print the current line
X :37p print line 37
X :'gp print the line which contains mark g
X :/foo/p print the next line that contains "foo"
X :$p print the last line of the file
X :20,30p print lines 20 through 30
X :1,$p print all lines of the file
X :%p print all lines of the file
X :/foo/-2,+4p print 5 lines around the next "foo"
X.TA
X.DE
X.NH 2
XText Entry Commands
X.if n .ul 0
X.ID
X.ps
X[line] append
X[line][,line] change ["x]
X[line] insert
X.DE
X.PP
XThe \fBa\fRppend command inserts text after the specified line.
X.PP
XThe \fBi\fRnsert command inserts text before the specified line.
X.PP
XThe \fBc\fRhange command copies the range of lines into a cut buffer,
Xdeletes them, and inserts new text where the old text used to be.
X.PP
XFor all of these commands, you indicate the end of the text you're
Xinserting by hitting ^D or by entering a line which contains only a
Xperiod.
X.NH 2
XCut & Paste Commands
X.if n .ul 0
X.ID
X.ps
X[line][,line] delete ["x]
X[line][,line] yank ["x]
X[line] put ["x]
X[line][,line] copy line
X[line][,line] to line
X[line][,line] move line
X.DE
X.PP
XThe \fBd\fRelete command copies the specified range of lines into a
Xcut buffer, and then deletes them.
X.PP
XThe \fBy\fRank command copies the specified range of lines into a cut
Xbuffer, but does *not* delete them.
X.PP
XThe \fBpu\fRt command inserts text from a cut buffer after the
Xspecified line.
X.PP
XThe \fBco\fRpy and \fBt\fRo commands yank the specified range of lines and
Xthen immediately paste them after some other line.
X.PP
XThe \fBm\fRove command deletes the specified range of lines and then
Ximmediately pastes them after some other line.
XIf the destination line comes after the deleted text,
Xthen it will be adjusted automatically to account for the deleted lines.
X.NH 2
XDisplay Text Commands
X.if n .ul 0
X.ID
X.ps
X[line][,line] print
X[line][,line] list
X[line][,line] number
X.DE
X.PP
XThe \fBp\fRrint command displays the specified range of lines.
X.PP
XThe \fBnu\fRmber command displays the lines, with line numbers.
X.PP
XThe \fBl\fRist command also displays them, but it is careful to make
Xcontrol characters visible.
X.NH 2
XGlobal Operations Commands
X.if n .ul 0
X.ID
X.ps
X[line][,line] global /regexp/ command
X[line][,line] vglobal /regexp/ command
X.DE
X.PP
XThe \fBg\fRlobal command searches through the lines of the specified range
X(or through the whole file if no range is specified)
Xfor lines that contain a given regular expression.
XIt then moves the cursor to each of these lines and
Xruns some other command on them.
X.PP
XThe \fBv\fRglobal command is similar, but it searches for lines that \fIdon't\fR
Xcontain the regular expression.
X.NH 2
XLine Editing Commands
X.if n .ul 0
X.ID
X.ps
X[line][,line] join[!]
X[line][,line] ! program
X[line][,line] <
X[line][,line] >
X[line][,line] substitute /regexp/replacement/[p][g][c]
X[line][,line] &
X.DE
X.PP
XThe \fBj\fRoin command catenates all lines in the specified range together
Xto form one big line.
XIf only a single line is specified, then the following line is catenated
Xonto it.
XThe normal ":join" inserts one or two spaces between the lines;
Xthe ":join!" variation (with a '!') doesn't insert spaces.
X.PP
XThe \fB!\fR command runs an external filter program,
Xand feeds the specified range of lines to it's stdin.
XThe lines are then replaced by the output of the filter.
XA typical example would be ":'a,'z!sort" to sort the lines 'a,'z.
X.PP
XThe \fB<\fR and \fB>\fR commands shift the specified range of lines left or right,
Xnormally by the width of 1 tab character.
XThe "shiftwidth" option determines the shifting amount.
X.PP
XThe \fBs\fRubstitute command finds the regular expression in each line,
Xand replaces it with the replacement text.
XThe "p" option causes the altered lines to be printed.
XThe "g" option permits all instances of the regular expression
Xto be found & replaced.
X(Without "g", only the first occurrence in each line is replaced.)
XThe "c" option asks for confirmation before each substitution.
X.PP
XThe \fB&\fR command repeats the previous substitution command.
XActually, "&" is equivelent to "s//~/" with the same options as last time.
XIt searches for the last regular expression that you specified for any purpose,
Xand replaces it with the the same text
Xthat was used in the previous substitution.
X.NH 2
XUndo Command
X.if n .ul 0
X.ID
X.ps
Xundo
X.DE
X.PP
XThe \fBu\fRndo command restores the file to the state it was in before
Xyour most recent command which changed text.
X.NH 2
XConfiguration & Status Commands
X.if n .ul 0
X.ID
X.ps
Xmap[!] [key mapped_to]
Xunmap[!] key
Xabbr [word expanded_form_of_word]
Xunabbr word
Xdigraph[!] [XX [Y]]
Xset [options]
Xmkexrc
X[line] mark "x
Xvisual
Xversion
X[line][,line] =
Xfile [file]
Xsource file
X@ "x
Xcolor [when] [["light"] color] ["on" color]
X.DE
X.PP
XThe \fBma\fRp command allows you to configure \*E to recognize your function keys,
Xand treat them as though they transmitted some other sequence of characters.
XNormally this mapping is done only when in the visual command mode,
Xbut with the [!] present it will map keys under input and replace modes as well.
XWhen this command is given with no arguments,
Xit prints a table showing all mappings currently in effect.
XWhen called with two arguments, the first is the sequence that your
Xfunction key really sends, and the second is the sequence that you want
X\*E to treat it as having sent.
XAs a special case, if the first argument is a number then \*E will map the
Xcorresponding function key;
Xfor example, ":map 7 dd" will cause the <F7> key to delete a line.
X.PP
XThe \fBunm\fRap command removes key definitions that were made via the map command.
X.PP
XThe \fBab\fRbr command is used to define/list a table of abbreviations.
XThe table contains both the abbreviated form and the fully spelled-out form.
XWhen you're in visual input mode, and you type in the abbreviated form,
X\*E will replace the abbreviated form with the fully spelled-out form.
XWhen this command is called without arguments, it lists the table;
Xwith two or more arguments, the first argument is taken as the abbreviated
Xform, and the rest of the command line is the fully-spelled out form.
X.PP
XThe \fBuna\fRbbr command deletes entries from the abbr table.
X.PP
XThe \fBdi\fRgraph command allows you to display the set of digraphs that \*E is
Xusing, or add/remove a digraph.
XTo list the set of digraphs, use the digraph command with no arguments.
XTo add a digraph, you should give the digraph command two arguments.
XThe first argument is the two ASCII characters that are to be combined;
Xthe second is the non-ASCII character that they represent.
XThe non-ASCII character's most significant bit is automatically set by the
Xdigraph command, unless to append a ! to the command name.
XRemoval of a digraph is similar to adding a digraph, except that you should
Xleave off the second argument.
X.PP
XThe \fBse\fRt command allows you examine or set various options.
XWith no arguments, it displays the values of options that have been changed.
XWith the single argument "all" it displays the values of all options,
Xregardless of whether they've been explicitly set or not.
XOtherwise, the arguments are treated as options to be set.
X.PP
XThe \fBmk\fRexrc command saves the current configuration to a file
Xcalled ".exrc" in the current directory.
X.PP
XThe mar\fBk\fR command defines a named mark to refer to a specific place
Xin the file.
XThis mark may be used later to specify lines for other commands.
X.PP
XThe \fBvi\fRsual command puts the editor into visual mode.
XInstead of emulating ex, \*E will start emulating vi.