forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelvis.9
More file actions
1258 lines (1141 loc) · 36.4 KB
/
Copy pathelvis.9
File metadata and controls
1258 lines (1141 loc) · 36.4 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
.so mnx.mac
.TH ELVIS 9
.CD "elvis \(en clone of the Berkeley vi editor"
.SX "elvis \fR[\fB\(enRerv\fR] [\fB\(ent \fItag\fR] \fR[\fIfile\fR] ..."
.FL "\(enR" "Set the read-only option"
.FL "\(ene" "Start up emulating \fIex\fR"
.FL "\(enr" "Tell the user to use \fIelvrec\fR instead
.FL "\(ent" "Start editing at the given tag"
.FL "\(env" "Start up emulating \fIvi\fR"
.EX "elvis" "Call the editor"
.EX "elvis prog.c" "edit \fIprog.c\fR"
.PP
\fIElvis\fR is a full-screen editor closely modeled on the famous Berkeley
\fIvi\fR editor.
It provides essentially the same interface to the user as \fIvi\fR, but the
code is completely new, written from scratch.
This document provides a brief introduction to \fIvi\fR.
It is not intended as a tutorial for beginners.
Most books on
.Ux
cover \fIvi\fR.
.PP
Like \fIvi\fR, \fIelvis\fR can operate as a screen editor
(\fIvi\fR mode) or as a line editor (\fIex\fR) mode.
It can be called either as \fIelvis\fR \fIvi\fR,or as \fIex\fR,
depending on which is desired.
They are all links to the same file.
.SS "Vi Commands"
.PP
Below is a list of the \fIvi\fR commands supported.
The following symbols are used in the table:
.HS
.in +1.25i
.ta +1.0i
.ti -1.0i
count Integer parameter telling how many or how much
.ti -1.0i
key One character parameter to the command
.ti -1.0i
inp Interactive input expected
.ti -1.0i
mv Indicates how much for commands like \fIdelete\fR and \fIchange\fR:
.in +0.8i
.ta +0.3i
.ti -0.3i
( Previous sentence
.ti -0.3i
) Next sentence
.ti -0.3i
{ Previous paragraph
.ti -0.3i
} Next paragraph (delimited by blank line, \fI.PP, .LP, .IP\fR etc.)
.ti -0.3i
[ Previous section (delimited by \fI.SH\fR or \fI.NH\fR)
.br
A repeated command character means the scope is this line
.in -0.8i
.ta +1.0i
.ti -1.0i
MOVE Indicates commands that may also be used where \fImv\fR is specified
.ti -1.0i
EDIT These commands affect text and may be repeated by the \fI.\fR command
.in -1.25i
.HS
In addition to the above notation, the caret (^) is used as an abbreviation
for CTRL.
For example, ^A means CTRL-A.
.HS
.in +2i
.ta +1i +1i +3.3i
.ti -2i
\fBCount~~~~ Command Description Type\fR
.ti -2i
^A (Not defined)
.ti -2i
^B Move toward the top of the file by 1 screenful
.ti -2i
^C (Not defined)
.ti -2i
count ^D Scroll down \fIcount\fR lines (default 1/2 screen)
.ti -2i
count ^E Scroll up \fIcount\fR lines
.ti -2i
^F Move toward the bottom of the file by 1 screenful
.ti -2i
^G Show file status, and the current line
.ti -2i
count ^H Move left, like \fIh\fR MOVE
.ti -2i
^I (Not defined)
.ti -2i
count ^J Move down MOVE
.ti -2i
^K (Not defined)
.ti -2i
^l Redraw the screen
.ti -2i
count ^M Move to the front of the next line MOVE
.ti -2i
count ^N Move down MOVE
.ti -2i
^O (Not defined)
.ti -2i
count ^P Move up MOVE
.ti -2i
^Q (Not defined)
.ti -2i
^R Redraw the screen
.ti -2i
^S (Not defined)
.ti -2i
^T (Not defined)
.ti -2i
count ^U Scroll up \fIcount\fR lines (default 1/2 screen)
.ti -2i
^V (Not defined)
.ti -2i
^W (Not defined)
.ti -2i
^X (Not defined)
.ti -2i
count ^Y Scroll down \fIcount\fR lines
.ti -2i
^Z (Not defined)
.ti -2i
ESC (Not defined)
.ti -2i
^\e (Not defined)
.ti -2i
^] If the cursor is on a tag name, go to that tag
.ti -2i
^^ Save this file and edit the previous file
.ti -2i
^_ (Not defined)
.ti -2i
count SPACE Move right,like \fIl\fR MOVE
.ti -2i
! mv Run the selected lines thru an external filter program
.ti -2i
" key Select which cut buffer to use next
.ti -2i
# (Not defined)
.ti -2i
$ Move to the rear of the current line MOVE
.ti -2i
% move to the matching (){}[] character MOVE
.ti -2i
& (Not defined)
.ti -2i
' key Move to a marked line MOVE
.ti -2i
count ( Move backward \fIcount\fR sentences MOVE
.ti -2i
count ) Move forward \fIcount\fR sentences MOVE
.ti -2i
* (Not defined)
.ti -2i
count + Move to the front of the next line MOVE
.ti -2i
count , Repeat the previous [\fIfFtT\fR] but the other way MOVE
.ti -2i
count \(en Move to the front of the preceding line MOVE
.ti -2i
. Repeat the previous \*(OQedit\*(CQ command
.ti -2i
/ Text search forward for a given regular expr MOVE
.ti -2i
0 If not part of count, move to 1st char of this line MOVE
.ti -2i
1 Part of count
.ti -2i
2 Part of count
.ti -2i
3 Part of count
.ti -2i
4 Part of count
.ti -2i
5 Part of count
.ti -2i
6 Part of count
.ti -2i
7 Part of count
.ti -2i
8 Part of count
.ti -2i
9 Part of count
.ti -2i
: Text. Run single \fIex\fR cmd
.ti -2i
count ; Repeat the previous [fFtT] cmd MOVE
.ti -2i
count < mv Shift text left EDIT
.ti -2i
= (Not defined)
.ti -2i
count > mv Shift text right EDIT
.ti -2i
? text Search backward for a given regular expression MOVE
.ti -2i
@ (Not defined)
.ti -2i
count A inp Append at end of the line EDIT
.ti -2i
count B Move back Word MOVE
.ti -2i
C inp Change text from cursor through end of line EDIT
.ti -2i
D Delete text from cursor through end of line EDIT
.ti -2i
count E Move end of Word MOVE
.ti -2i
count F key Move leftward to a given character MOVE
.ti -2i
count G Move to line #\fIcount\fR (default is the bottom line) MOVE
.ti -2i
count H Move to home row (the line at the top of the screen)
.ti -2i
count I inp Insert at the front of the line (after indents) EDIT
.ti -2i
count J Join lines, to form one big line EDIT
.ti -2i
K Look up keyword
.ti -2i
count L Move to last row (the line at the bottom of the screen)
.ti -2i
M Move to middle row (the line in the middle)
.ti -2i
N Repeat previous search, but the opposite way MOVE
.ti -2i
count O inp Open up a new line above the current line EDIT
.ti -2i
P Paste text before the cursor
.ti -2i
Q Quit to EX mode
.ti -2i
R inp Overtype EDIT
.ti -2i
count S inp Change lines, like \fIcount\fRcc
.ti -2i
count T key Move leftward \fIalmost\fR to a given character MOVE
.ti -2i
U Undo all recent changes to the current line
.ti -2i
V (Not defined)
.ti -2i
count W Move forward \fIcount\fR Words MOVE
.ti -2i
count X Delete the character(s) to the left of the cursor EDIT
.ti -2i
count Y Yank text line(s) (copy them into a cut buffer)
.ti -2i
Z Z Save the file & exit
.ti -2i
[ [ Move back 1 section MOVE
.ti -2i
\e (Not defined)
.ti -2i
] ] Move forward 1 section MOVE
.ti -2i
^ Move to the front of the current line (after indent) MOVE
.ti -2i
\(ul (Not defined)
.ti -2i
` key Move to a marked character MOVE
.ti -2i
count a inp Insert text after the cursor EDIT
.ti -2i
count b Move back \fIcount\fR words MOVE
.ti -2i
c mv Change text EDIT
.ti -2i
d mv Delete text EDIT
.ti -2i
count e Move forward to the end of the current word MOVE
.ti -2i
count f key Move rightward to a given character MOVE
.ti -2i
g (Not defined)
.ti -2i
count h Move left MOVE
.ti -2i
count i inp Insert text at the cursor EDIT
.ti -2i
count j Move down MOVE
.ti -2i
count k Move up MOVE
.ti -2i
count l Move right MOVE
.ti -2i
m key Mark a line or character
.ti -2i
n Repeat the previous search MOVE
.ti -2i
count o inp Open a new line below the current line EDIT
.ti -2i
p Paste text after the cursor
.ti -2i
q (Not defined)
.ti -2i
count r key Replace \fIcount\fR chars by a given character EDIT
.ti -2i
count s inp Replace \fIcount\fR chars with text from the user EDIT
.ti -2i
count t key Move rightward \fIalmost\fR to a given character MOVE
.ti -2i
u Undo the previous edit command
.ti -2i
v (Not defined)
.ti -2i
count w Move forward \fIcount\fR words MOVE
.ti -2i
count x Delete the character that the cursor's on EDIT
.ti -2i
y mv Yank text (copy it into a cut buffer)
.ti -2i
z key Scroll current line to the screen's +=top -=bottom .=middle
.ti -2i
count { Move back \fIcount\fR paragraphs MOVE
.ti -2i
count | Move to column \fIcount\fR (the leftmost column is 1)
.ti -2i
count } Move forward \fIcount\fR paragraphs MOVE
.ti -2i
.tr ~~
count \(ap Switch a character between upper & lower case EDIT
.tr ~
.ti -2i
DEL (Not defined)
.in -2i
.SS "Ex Commands"
.PP
Below is a list of the \fIex\fR commands supported. All can be abbreviated.
.UU "General"
.LP
.nf
.ta 1.2i 2.4i
[line] append
args [files]
cd [directory]
chdir [directory]
[line][,line] change
[line][,line] copy line
[line][,line] debug[!]
[line][,line] Delete [\*(CQx]
edit[!] [file]
ex[!] [file]
file
[line][,line] global /regexp/ command
[line] Insert
[line][,line] join
[line][,line] list
map[!] key mapped_to
[line] mark x
mkexrc
[line][,line] Move line
next[!] [files]
Next[!]
previous[!]
[line][,line] print
[line] put [\*(CQx]
quit[!]
[line] read file
rewind[!]
set [options]
[line][,line] substitute /regexp/replacement/[p][g]
tag[!] tagname
[line][,line] to line
Undo
unmap[!] key
validate[!]
version
[line][,line] vglobal /regexp/ command
visual
wq
[line][,line] write[!] [[>>]file]
xit[!]
[line][,line] yank [\*(CQx]
[line][,line] ! command
[line][,line] <
[line][,line] =
[line][,line] >
.SP 0.25
.UU "Text Entry"
.SP 0.25
.LP
.ta 1.2i 2.4i
.nf
[line] append
[line][,line] change [\*(CQx]
[line] Insert
.fi
The (a)ppend command inserts text after the specified line.
The (i)nsert command inserts text before the specified line.
The (c)hange command copies the range of lines into a cut buffer,
deletes them, and inserts new text where the old text used to be.
For all of these commands, you indicate the end of the text you're
inserting by hitting ^D or by entering a line which contains only
a period.
.SP 0.25
.UU "Cut & Paste"
.SP 0.25
.LP
.ta 1.2i 2.4i
.nf
[line][,line] Delete [\*(CQx]
[line][,line] yank [\*(CQx]
[line] put[!] [\*(CQx]
[line][,line] copy line
[line][,line] to line
[line][,line] Move line
.fi
The (d)elete command copies the specified range of lines into a
cut buffer, and then deletes them.
The (y)ank command copies the specified range of lines into a cut
buffer, but does \fInot\fR delete them.
The (pu)t command inserts text from a cut buffer after the specified
line\(emor before it if the ! is present.
The (co)py and (t)o commands yank the specified range of lines and then
immediately paste them after some other line.
The (m)ove command deletes the specified range of lines and then
immediately pastes them after some other line. If the destination
line comes after the deleted text, then it will be adjusted
automatically to account for the deleted lines.
.UU "Displaying Text"
.LP
.ta 1.2i 2.4i
.nf
[line][,line] print
[line][,line] list
.fi
The (p)rint command displays the specified range of lines.
The (l)ist command also displays them, but it is careful to make
control characters visible.
.UU "Global Operations"
.LP
.ta 1.2i 2.4i
.nf
[line][,line] global /regexp/ command
[line][,line] vglobal /regexp/ command
.fi
The (g)lobal command searches through the lines of the specified range
(or through the whole file if no range is specified) for lines that
contain a given regular expression. It then moves the cursor to each
of these lines and runs some other command on them.
The (v)global command is similar, but it searches for lines that
\fIdo not\fR contain the regular expression.
.UU "Line Editing"
.LP
.ta 1.2i 2.4i
.nf
[line][,line] join
[line][,line] ! program
[line][,line] <
[line][,line] >
[line][,line] substitute /regexp/replacement/[p][g]
.fi
The (j)oin command concatenates all lines in the specified range together
to form one big line. If only a single line is specified, then the
following line is catenated onto it.
The ! command runs an external filter program, and feeds the specified
range of lines to it's stdin. The lines are then replaced by the
output of the filter. A typical example would be \*(OQ:'a,'z!sort -n\*(CQ to
sort the lines 'a,'z according to their numeric values.
The < and > commands shift the specified range of lines left or right,
normally by the width of 1 tab character. The \*(OQshiftwidth\*(CQ option
determines the shifting amount.
The (s)ubstitute command finds the regular expression in each line,
and replaces it with the replacement text. The \*(OQp\*(CQ option causes
the altered lines to be printed, and the \*(OQg\*(CQ option permits all
instances of the regular expression to be found & replaced. (Without
\*(OQg\*(CQ, only the first occurrence is replaced.)
.SP 0.25
.UU "Undo"
.SP 0.25
.LP
.ta 1.2i 2.4i
.nf
undo
.fi
The (u)ndo command restores the file to the state it was in before your
most recent command which changed text.
.SP 0.25
.UU "Configuration & Status"
.SP 0.25
.LP
.ta 1.2i 2.4i
.nf
map[!] [key mapped_to]
unmap[!] key
set [options]
mkexrc
[line] mark x
visual
version
[line][,line] =
file
.fi
The (ma)p command allows you to configure \fIelvis\fR to recognize your
function keys, and treat them as though they transmitted some other
sequence of characters. Normally this mapping is done only when in
the visual command mode, but with the [!] present it will map keys
under all contexts. When this command is given with no arguments,
it prints a table showing all mappings currently in effect. When
called with two arguments, the first is the sequence that your
function key really sends, and the second is the sequence that you
want \fIelvis\fR to treat it as having sent.
The (unm)ap command removes key definitions that were made via the
map command.
The (se)t command allows you examine or set various options. With
no arguments, it displays the values of options that have been
changed. With the single argument \*(OQall\*(CQ it displays the values of
all options, regardless of whether they've been explicitly set or
not. Otherwise, the arguments are treated as options to be set.
The (mk)exrc command saves the current configuration to a file
called \fI.exrc\fR in the current directory.
The mar(k) command defines a named mark to refer to a specific place
in the file. This mark may be used later to specify lines for other
commands.
The (vi)sual command puts the editor into visual mode. Instead of
emulating ex, \fIelvis\fR will start emulating vi.
The (ve)rsion command tells you that what version of \fIelvis\fR this is.
The = command tells you what line you specified, or, if you specified
a range of lines, it will tell you both endpoints and the number of
lines included in the range.
The file command tells you the name of the file, whether it has been
modified, the number of lines in the file, and the current line number.
.UU "Multiple Files"
.LP
.ta 1.2i 2.4i
.nf
args [files]
next[!] [files]
Next[!]
previous[!]
rewind[!]
.fi
When you invoke \fIelvis\fR from your shell's command line, any filenames
that you give to \fIelvis\fR as arguments are stored in the args list. The
(ar)gs command will display this list, or define a new one.
The (n)ext command switches from the current file to the next one in
the args list. You may specify a new args list here, too.
The (N)ext and (pre)vious commands (they're really aliases for the same
command) switch from the current file to the preceding file in the
args list.
The (rew)ind command switches from the current file to the first file
in the args list.
.SP 1
.UU "Switching Files"
.SP 1
.LP
.ta 1.2i 2.4i
.nf
edit[!] [file]
tag[!] tagname
.fi
The (e)dit command allows to switch from the current file to some other
file. This has nothing to do with the args list, by the way.
The (ta)g command looks up a given tagname in a file called \*(OQtags".
This tells it which file the tag is in, and how to find it in that file.
\fIElvis\fR then switches to the tag's file and finds the tag.
.SP 1
.UU "Exiting"
.SP 1
.LP
.ta 1.2i 2.4i
.nf
quit[!]
wq
xit
.fi
The (q)uit command exits from the editor without saving your file.
The (wq) and (x)it commands (really two names for the same command)
both write the file before exiting.
.UU "File I/O"
.LP
.ta 1.2i 2.4i
.nf
[line] read file
[line][,line] write[!][[>>]file]
.fi
The (r)ead command gets text from another file and inserts it after
the specified line.
.fi
The (w)rite command writes the whole file, or just part of it, to
some other file. The !, if present, will permit the lines to be
written even if you've set the readonly option. If you precede the
filename by >> then the lies will be appended to the file.
.UU "Directory"
.LP
.ta 1.2i 2.4i
.nf
cd [directory]
chdir [directory]
shell
.fi
The (cd) and (chd)ir commands (really two names for one command)
switch the current working directory.
The (sh)ell command starts an interactive shell.
.SP 0.5
.UU "Debugging"
.SP 0.5
.LP
.ta 1.2i 2.4i
.nf
[line][,line] debug[!]
validate[!]
.fi
These commands are only available if you compile \fIelvis\fR with the
\fB-DDEBUG\fR flag.
The de(b)ug command lists stats for the blocks which contain the
specified range of lines. If the ! is present, then the contents
of those blocks is displayed, too.
The (va)lidate command checks certain variables for internal
consistency. Normally it does not output anything unless it detects
a problem. With the !, though, it will always produce *some*
output.
.SP 0.5
.SS "Extensions"
.SP 0.5
.PP.
.ta 1i
.in +0.25i
In addition to the standard commands, a variety of extra features are
present in \fIelvis\fR that are not present in \fIvi\fR.
They are described below.
.ti -0.25i
.B .exrc
.br
\fIElvis\fR first runs a \fI.exrc\fR file (if there is one) from your $HOME
directory. After that, it runs a \fI.exrc\fR (if there is one) from the
current directory. The one in the current directory may override
settings made by the one in the $HOME directory.
.ti -0.25i
.B :mkexrc
.ti -0.25i
.B :mk
.br
This EX command saves the current :set and :map configurations in
the \*(OQ.exrc\*(CQ file in your current directory.
.ti -0.25i
.B :args
.ti -0.25i
.B :ar
.br
You can use the :args command to define a new args list, as in:
:args *.h
After you have defined a new args list, the next time you issue a
:next command \fIelvis\fR will switch to the first file of the new list.
.ti -0.25i
.B :Next
.ti -0.25i
.B :previous
.ti -0.25i
.B :N
.ti -0.25i
.B :pre
.br
These commands move backwards through the args list.
.ti -0.25i
.B zz
.br
In VI, the (lowercase) \*(OQzz\*(CQ command will center the current line on
the screen, like \*(OQz="
.ti -0.25i
.B .
.br
The default count value for . is the same as the previous command
which . is meant to repeat. However, you can supply a new count
if you wish.
For example, after \*(OQ3dw\*(CQ, \*(OQ.\*(CQ will delete 3 words,
but \*(OQ5.\*(CQ will delete 5 words.
.ti -0.25i
\fB"\fR
.br
The text which was most recently input (via a \*(OQcw\*(CQ command, or
something similar) is saved in a cut buffer called ". (which is a
pretty hard name to write in an English sentence). You can use this
with the \*(OQp\*(CQ or \*(OQP\*(CQ commands thusly:
.HS
".p
.HS
.ti -0.25i
.B K
.br
You can move the cursor onto a word and press shift-K to have \fIelvis\fR
run a reference program to look that word up. This command alone is
worth the price of admission! See the ctags and ref programs.
.ti -0.25i
.B input
.br
You can backspace back past the beginning of the line.
If you type CTRL-A, then the text that you input last time is
inserted. You will remain in input mode, so you can backspace over
part of it, or add more to it. (This is sort of like CTRL-@ on
the real vi, except that CTRL-A really works.)
Real \fIvi\fR can only remember up to 128 characters of input, but \fIelvis\fR
can remember any amount.
.ti -0.25i
.B :set
charattr
.ti -0.25i
.B :se
ca
.br
\fIElvis\fR can display \*(OQbackslash-f\*(CQ style character attributes on the
screen as you edit. The following example shows the recognized
attributes:
normal \fBboldface\fR \fIitalics\fR
NOTE: you must compile \fIelvis\fR without the \(enDSET_NOCHARATTR flag for
this to work.
.in -0.25i
.SS "Omissions"
.PP
A few \fIvi\fR features are missing.
The replace mode is a hack. It does not save the text that it overwrites.
.PP
Long lines are displayed differently\(emwhere the real vi would wrap a long
line onto several rows of the screen, \fIelvis\fR simply displays part of the line,
and allows you to scroll the screen sideways to see the rest of it.
.PP
The \*(OQ:preserve\*(CQ and \*(OQ:recover\*(CQ commands are missing, as
is the \fB\(enr\fR flag.
\*(OQ:Preserve" is practically never used and since use of \*(OQ:recover\\*(CQ
is so rare, it was decided to implement it as a separate program. There's no
need to load the recovery code into memory every time you edit a file.
.PP
LISP support is missing.
The \*(OQ@\*(CQ and \*(OQ:@\*(CQ commands are missing.
You cannot APPEND to a cut buffer.
.SS "Options"
.PP
A variety of options can be set as described below:
.HS
.nf
.in +0.25i
.ta 0.9i 1.35i 2.1i 3.0i
\fBName Abbr Type Default Description\fR
autoindent as Bool FALSE autoindent during input?
autowrite aw Bool FALSE write file for :n command?
charattr ca Bool FALSE display bold & underline chars?
columns co Number 80 width of screen, in characters
directory dir String /usr/tmp where tmp files are kept
errorbells eb Bool TRUE ring bell on error?
exrefresh er Bool TRUE EX mode calls write() often?
ignorecase ic Bool FALSE searches: upper/lowercase OK?
keytime kt Number 1 allow slow receipt of ESC seq?
keywordprg kp String /usr/bin/ref program to run for shift-K
lines ln Number 25 height of screen, in lines
list li Bool FALSE show tabs as \*(OQ^I\*(CQ?
magic ma Bool TRUE searches: allow metacharacters?
paragraphs pa String PPppPApa paragraphs start with .PP, etc.
readonly ro Bool FALSE no file should be written back?
report re Number 5 report changes to X lines?
scroll sc Number 12 default #lines for ^U and ^D
sections se String SEseSHsh sections start with .SE, etc.
shell sh String \fI/bin/sh\fR shell program, from environment
shiftwidth sw Number 8 width of < or > commands
sidescroll ss Number 8 #chars to scroll sideways by
sync sy Bool FALSE call sync() after each change?
tabstop ts Number 8 width of a tab character
term te String "?" terminal type, from environment
vbell vb Bool TRUE use visible bell if possible?
warn wa Bool TRUE warn if file not saved for :!cmd
wrapmargin wm Number 0 Insert newline after which col?
wrapscan ws Bool TRUE searches: wrap at EOF?
.fi
.ti -0.25i
.B autoindent
.br
During input mode, the autoindent option will cause each added line
to begin with the same amount of leading whitespace as the line above
it. Without autoindent, added lines are initially empty.
.ti -0.25i
.B autowrite
.br
When you're editing one file and decide to switch to another\(emvia
the :tag command, or :next command, perhaps\(emif your current
file has been modified, then \fIelvis\fR will normally print an error
message and refuse to switch.
However, if the autowrite option is on, then \fIelvis\fR will write the
modified version of the current file and successfully switch to the
new file.
.ti -0.25i
.B charattr
.br
Many text formatting programs allow you to designate portions of
your text to be underlined, italicized, or boldface by embedding
the special strings \\fU, \\fI, and \\fB in your text. The special
string \\fR marks the end of underlined or boldface text.
\fIElvis\fR normally treats those special strings just like any other
text.
However, if the \fIcharattr\fR option is on, then \fIelvis\fR will interpret
those special strings correctly, to display underlined or boldface
text on the screen. (This only works, of course, if your terminal
can display underlined and boldface, and if the TERMCAP entry says
how to do it.)
.ti -0.25i
.B columns
.br
This is a \*(OQread only\*(CQ option. You cannot change its value, but you
can have \fIelvis\fR print it. It shows how wide your screen is.
.ti -0.25i
.B directory
.br
Elvis uses temporary files to store changed text.
This option allows you to control where those temporary files will be.
Ideally, you should store them on in fast non-volatile memory,
such as a hard disk.
This option can only be set in the ".exrc" file.
.ti -0.25i
.B errorbells
.br
Normally, \fIelvis\fR will ring your terminal's bell if you make an error.
However, in noerrorbells mode, your terminal will remain silent.
.ti -0.25i
.B exrefresh
.br
The EX mode of \fIelvis\fR writes many lines to the screen. You can make
\fIelvis\fR either write each line to the screen separately, or save up
many lines and write them all at once.
The exrefresh option is normally on, so each line is written to the
screen separately.
You may wish to turn the exrefresh option off (:se noer) if the
\*(OQwrite\*(CQ system call is costly on your machine, or if you're using a
windowing environment. (Windowing environments scroll text a lot
faster when you write many lines at once.)
This option has no effect in \fIvi\fR mode.
.ti -0.25i
.B ignorecase
.br
Normally, when \fIelvis\fR searches for text, it treats uppercase letters
as being different for lowercase letters.
When the ignorecase option is on, uppercase and lowercase are treated
as equal.
.ti -0.25i
.B keytime
.br
The arrow keys of most terminals send a multi-character sequence.
It takes a measurable amount of time for these sequences to be
transmitted. The keytime option allows you to control the maximum
amount of time to allow for an arrow key (or other mapped key) to
be received in full.
The default keytime value is 2. Because of the way
.Ux
timekeeping works, the actual amount of time allowed will vary slightly, but it
will always be between 1 and 2 seconds.
If you set keytime to 1, then the actual amount of time allowed will
be between 0 and 1 second. This will generally make the keyboard's
response be a little faster (mostly for the ESC key), but on those
occasions where the time allowed happens to be closer to 0 than 1
second, \fIelvis\fR may fail to allow enough time for an arrow key's
sequence to be received fully. Ugh.
As a special case, you can set keytime to 0 to disable this time
limit stuff altogether. The big problem here is: If your arrow
keys' sequences start with an ESC, then every time you hit your ESC
key \fIelvis\fR will wait... and wait... to see if maybe that ESC was
part of an arrow key's sequence.
NOTE: this option is a generalization of the timeout option of the
real vi.
.ti -0.25i
.B keywordprg
.br
\fIElvis\fR has a special keyword lookup feature. You move the cursor
onto a word, and hit shift-K, and \fIelvis\fR uses another program to
look up the word and display information about it.
This option says which program gets run. It should contain the full
pathname of the program; your whole execution path is \fInot\fR checked.
The default value of this option is \fI/usr/bin/ref\fR, which is a
program that looks up the definition of a function in C. It looks
up the function name in a file called \*(OQrefs\*(CQ which is created by
ctags.
You can substitute other programs, such as an English dictionary
program or the online manual. \fIelvis\fR runs the program, using the
keyword as its only argument. The program should write information
to stdout. The program's exit status should be 0, unless you want
\fIelvis\fR to print \*(OQ<<< failed >>>".
.ti -0.25i
.B lines
.br
This \*(OQread only\*(CQ option shows how many lines you screen has.
.ti -0.25i
.B list
.br
Normally (in \*(OQnolist" mode) \fIelvis\fR will expand tabs to the proper
number of spaces on the screen, so that the file appears the same would it would
be if you printed it or looked at it with \fImore\fR.
Sometimes, though, it can be handy to have the tabs displayed as \*(OQ^I".
In \*(OQlist" mode, \fIelvis\fR does this, and also displays a \*(OQ$"
after the end of the line.
.ti -0.25i
.B magic
.br
The search mechanism in \fIelvis\fR can accept \*(OQregular
expressions\*(CQ\(emstrings in which certain characters have special meaning.
The magic option is normally on, which causes these characters to
be treated specially.
If you turn the magic option off (:se noma), then all characters
except ^ and $ are treated literally. ^ and $ retain their special
meanings regardless of the setting of magic.
.ti -0.25i
.B paragraphs
.br
The { and } commands move the cursor forward or backward in increments
of one paragraph. Paragraphs may be separated by blank lines, or by
a \*(OQdot\*(CQ command of a text formatter. Different text formatters use
different \*(OQdot\*(CQ commands. This option allows you to configure \fIelvis\fR
to work with your text formatter.
It is assumed that your formatter uses commands that start with a
".\*(CQ character at the front of a line, and then have a one- or
two-character command name.
The value of the paragraphs option is a string in which each pair
of characters is one possible form of your text formatter's paragraph
command.