This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / usr.bin / elvis / doc / differ.ms
CommitLineData
15637ed4
RG
1.Go 7 "DIFFERENCES BETWEEN \*E & BSD VI/EX"
2.PP
3\*E is not 100% compatible with the real vi/ex.
4\*E has many small extensions, some omissions, and a few features which
5are implemented in a slightly different manner.
6.NH 2
7Extensions
8.IP "Save Configuration" 1i
78ed81a3 9The :mkexrc command saves the current :set, :map, :ab, :color, and :digraph
10configurations in the ".exrc" file in your current directory.
15637ed4
RG
11.IP "Previous File" 1i
12The :N or :prev command moves backwards through the args list.
13.IP "Center Current Row" 1i
14In visual command mode, the (lowercase) "zz" command will center the current
15line on the screen, like "z=".
16.IP "Changing Repeat Count" 1i
17The default count value for . is the same as the previous command
18which . is meant to repeat.
19However, you can supply a new count if you wish.
20For example, after "3dw", "." will delete 3 words,
21but "5." will delete 5 words.
22.IP "Previous Text" 1i
23The text which was most recently input
24(via a "cw" command, or something similar)
25is saved in a cut buffer called ". (which
26is a pretty hard name to write in an English sentence).
27.IP "Keyword Lookup" 1i
28In visual command mode, you can move the cursor onto a word and press
29shift-K to have \*E run a reference program to look that word up.
30This command alone is worth the price of admission!
31See the ctags and ref programs.
32.IP "Increment/Decrement" 1i
33In visual command mode, you can move the cursor onto a number and
34then hit ## or #+ to increment that number by 1.
35To increment it by a larger amount,
36type in the increment value before hitting the initial #.
37The number can also be decremented or set by hitting #- or #=, respectively.
38.IP "Input Mode" 1i
39You can backspace past the beginning of the line.
40.IP "" 1i
41The arrow keys work in input mode.
42.IP "" 1i
43If you type control-A, then the text that you input last time is inserted.
44You will remain in input mode, so you can backspace over part of it,
45or add more to it.
46(This is sort of like control-@ on the real vi,
47except that control-A really works.)
48.IP "" 1i
49Control-P will insert the contents of the cut buffer.
50.IP "" 1i
51Real vi can only remember up to 128 characters of input,
52but \*E can remember any amount.
53.IP "" 1i
54The ^T and ^D keys can adjust the indent of a line no matter where
55the cursor happens to be in that line.
56.IP "" 1i
57You can save your file and exit \*E directly from input mode by hitting
58control-Z twice.
59.IP "" 1i
60\*E supports digraphs as a way to enter non-ASCII characters.
61.IP "Start in Input Mode" 1i
62If you ":set inputmode" in your .exrc file, then \*E will start up in
63input mode instead of visual command mode.
64.IP "Visible Fonts" 1i
65With ":set charattr", \*E can display "backslash-f" style character attributes on the
66screen as you edit.
67The following example shows the recognized atributes:
68.sp
69.ti +0.5i
70normal \\fBboldface\\fR \\fIitalics\\fR \\fUunderlined\\fR normal
71.sp
72NOTE: you must compile \*E without the -DNO_CHARATTR flag for
73this to work.
74.IP "File Syncing" 1i
75After a crash, you can usually recover the altered form of the file
76from the temporary file that \*E uses -- unless the temporary file was
77corrupted.
78.IP "" 1i
79UNIX systems use a delayed-write cache, which means that when \*E tries to
80write to the temporary file, the information might still be in RAM instead
81of on the disk.
82A power failure at that time would cause the in-RAM information to be lost.
83UNIX's sync() call will force all such information to disk.
84.IP "" 1i
85MS-DOS and Atari TOS don't write a file's length to disk until that file
86is closed.
87Consequently, the temporary file would appear to be 0 bytes long if power
88failed when we were editing.
89To avoid this problem, a sync() function has been written which will close
90the temporary file and then immediately reopen it.
91.IP "Cursor Shape" 1i
92\*E changes the shape of the cursor to indicate which mode you're in,
93if your terminal's termcap entry includes the necessary capabilities.
94.IP "Hide nroff Lines" 1i
78ed81a3 95The ":set hideformat" option hides nroff format control lines.
15637ed4
RG
96(They are displayed on the screen as blank lines.)
97.ne 7
98.IP "Compiler Interface" 1i
99\*E is clever enough to parse the error messages emitted by many compilers.
100To use this feature,
101you should collect your compiler's error messages into a file called "errlist";
102\*E will read this file,
103determine which source file caused the error messages,
104start editing that file,
105move the cursor to the line where the error was detected,
106and display the error message on the status line.
107Nifty!
108.IP "Visible Text Selection" 1i
109In visual command mode, 'v' starts visibly selecting characters and
110\&'V' starts visibly selecting whole lines.
111The character or line where the cursor is located becomes one
112endpoint of the selection.
113You can then use the standard cursor movement commands to move the cursor
114to the other endpoint, and then press one of the operator commands
115(c/d/y/</>/!/=/\\).
116The operator will then immediately be applied to the selected text.
117.IP "Pop-up Menu Operator" 1i
118The '\\' key is a new operator,
78ed81a3 119similar in operation to the c/d/y/</>/! operators.
15637ed4
RG
120It conjures up a menu, from which you can select any of the other
121operators plus a few other common commands.
122.IP "Preset Filter Operator" 1i
123The '=' key is another new operator.
124It is similar to the '!' operator, except that while
125\&'!' asks you to type in a filter command each time,
126\&'=' assumes it should always run the command stored in the \fIequalprg\fR option.
127.IP "Move to a Given Percentage" 1i
128The '%' movement key can now accept an optional count.
129Without a count, the '%' key still moves to a matching parenthesis
130like it always did.
131With a count somewhere between 1 and 100, though, it moves the cursor to
132approximately a given percentage of the way through the file.
133For example, typing "50%" will move the cursor to the middle of the file.
134.IP "Regular Expressions"
135In regular expressions, several new forms of closure operators are supported:
136\\{\fIn\fR}, \\{\fIn\fR,\fIm\fR}, \\+, and \\?.
137.NH 2
138Omissions
139.PP
140The replace mode is a hack.
141It doesn't save the text that it overwrites.
142.PP
143Long lines are displayed differently -- where the real vi would
144wrap a long line onto several rows of the screen, \*E simply
145displays part of the line, and allows you to scroll the screen
146sideways to see the rest of it.
147.PP
148The ":preserve" and ":recover" commands are missing.
149So is the -r flag.
150I've never had a good reason to use ":preserve",
151and since ":recover" is used so rarely
152I decided to implement it as a separate program.
153There's no need to load the recovery code into memory every
154time you edit a file, I figured.
155.PP
156LISP support is missing.
157However, the = key is still an operator that reformats lines of text.
158By default, it reformats lines by sending them through the \fIfmt\fP filter,
159but you could write your own LISP beautifier and configure elvis to use it.
160Key mappings could take care of most other differences.
161Auto-indent is the only thing that is irrecoverably lost.
162.PP
163Autoindent mode acts a little different from the real vi, anyway.
164It doesn't handle ^^D or 0^D correctly.
165On the other hand, it \fIdoes\fP allow ^D and ^T to be used anywhere in the
166line, to adjust the indentation for the whole line.