2 sed '/^X/s///' > cflags.ms
<< '/'
5 X\
*E uses many preprocessor symbols to control compilation.
6 XSome of these control the sizes of buffers and such.
7 XThe
"-DNO_XXXX" options remove small sets of related features.
9 XMost \
*E users will probably want to keep all features available.
10 XMinix-PC users
, though
, will have to sacrifice some sets because otherwise
11 X\
*E would be too bulky to compile.
12 XThe
"asld" phase of the compiler craps out.
13 X.IP
"-DM_SYSV, -Dbsd, -DTOS, -DCOHERENT, -Damiga"
14 XThese flags tell the compiler that \
*E is being compiled
for
15 XSystem-V UNIX
, BSD UNIX
, Atari TOS
, Coherent
, or AmigaDos
, respectively.
16 XFor other systems
, the config.h
file can generally figure it out automatically.
18 XFor MS-DOS systems
, this causes support
for the DEC Rainbow to be compiled
21 XSome versions of SysV UNIX don
't support support the "winsize"
22 Xstyle of screen-size testing,
23 Xso elvis ignores window size changes by default.
25 XHowever, many of the newer SysV systems defines "winsize" in the
26 Xfile "/usr/include/sys/ptem.h".
27 XIf your SysV system has "winsize" then you should add
28 X-DS5SWINSIZE to the CFLAGS setting.
30 XPOSIX is a SysV-derived specification which uses a terminal control
31 Xpackage called "termios", instead of "termio".
32 XSome other SysV systems may also use termios.
33 XYou can make elvis uses termios instead of the more common termio
34 Xby adding -DTERMIOS to CFLAGS.
35 X(Note: This hasn't been tested very well.
)
36 X.IP
-DNBUFS=\fInumber
\fP
37 X\
*E keeps most of your text
in a temporary
file;
38 Xonly a small amount is actually stored
in RAM.
39 XThis flag allows you to control how much of the
file can be
in RAM
at any
time.
40 XThe default is
5 blocks
, and the minimum is
3 blocks.
41 X
(See the
-DBLKSIZE flag
, below.
)
43 XMore RAM allows global changes to happen a little faster.
44 X f you
're just making many small changes in one section of a file, though,
45 Xextra RAM won't
help much.
46 X.IP
-DBLKSIZE=\fInumber
\fP
47 XThis controls the size of blocks that \
*E uses internally.
48 XThe value of BLKSIZE must be a power of two.
49 XEvery
time you double BLKSIZE
, you quadruple the size of a text
file that
50 X\
*E can handle
, but you also cause the temporary
file to grow faster.
51 XFor MS-DOS
, Coherent
, and Minix-PC
, the default value is
1024, which allows
52 Xyou to edit files up to almost
512K bytes long.
53 XFor all other systems
, the default value is
2048, which allows you to edit
54 Xfiles that are nearly
2 megabytes long.
56 XThe BLKSIZE also determines the maximum line length
, and a few other limits.
57 XBLKSIZE should be either
256, 512, 1024, or
2048.
58 XValues other than these can lead to strange behaviour.
59 X.IP
-DTMPDIR=\fIstring
\fP
60 XThis sets the default value of the
"directory" option
, which specifies where
61 Xthe temporary files should reside.
62 XThe value of TMPDIR must be a string
, so be sure your value includes the
63 Xquote characters on each end.
64 X.IP
"-DEXRC=\fIstr\fP, -DHMEXRC=\fIstr\fP, -DSYSEXRC=\fIstr\fP, -DEXINIT=\fIstr\fP"
65 XThis lets you control the names of the initialization files.
66 XTheir values must be
strings, so be careful about quoting.
68 XEXRC is the name of the initialization
file in the current directory.
69 XIts default value is
".exrc" on UNIX systems
-- the same as the real vi.
70 XSince that isn
't a legal DOS filename, under DOS the default is "elvis.rc".
71 XFor other systems, check the config.h file.
73 XHMEXRC is the name of the initialization file in your home directory.
74 XBy default, it is the same as EXRC.
75 X\*E will automatically prepend the name of your home directory to HMEXRC
76 Xat run time, so don't give a full path name.
78 XSYSEXRC is the name of a system-wide initialization
file.
79 XIt has no default value
;
80 Xif you don
't define a value for it, then
81 Xthe code that supports SYSEXRC just isn't compiled.
82 XThe value of SYSEXRC should be a full pathname
, in quotes.
84 XEXINIT is the name of an environment variable that can contain initialization
86 XNormally
, its value is
"EXINIT".
87 X.IP
-DKEYWORDPRG=\fIstring
\fP
88 XThis flag determines the default value of the
"keywordprg" option.
89 XIts value must be a string
, so be careful about quoting.
90 XThe default value of this flag is
"ref", which is a C reference program.
91 X.IP
"-DCC_COMMAND=\fIstring\fP -DMAKE_COMMAND=\fIstring\fP -DERRLIST=\fIstring\fP"
92 XThese control the names of the C compiler
, the
"make" utility
, and the
93 Xerror output
file, respectively.
94 XThey are only used
if -DNO_ERRLIST is not given.
96 XThe default value of CC_COMMAND depends on the Operating System and compiler
97 Xthat you use to compile elvis
;
98 Xfor UNIX
, the default is
"cc".
99 XThe default values of MAKE_COMMAND and ERRLIST are
"make" and
"errlist",
101 X.IP
-DMAXRCLEN=\fInumber
\fP
102 XThis determines how large a
:@ macro
command can be
(measured
in bytes
).
103 XThe default is
1000 bytes.
104 XIf you increase this value significantly
,
105 Xthen you may need to allocate extra memory
for the stack.
106 XSee the
"CHMEM" setting
in the Makefile.
107 X.IP
-DSHELL=\fIstring
\fP
108 XThis is the default value of the
"shell" option
, and hence
109 Xthe default shell used from within \
*E.
110 XThis only controls the default
;
111 Xthe value you give here may be overridden
at run-time by setting
112 Xan environment variable named SHELL
(or COMSPEC
for MS-DOS
).
113 XIts value must be a string constant
, so be careful about quoting.
114 X.IP
-DTAGS=\fIstring
\fP
115 XThis sets the name of the
"tags" file,
116 Xwhich is used by the
:tag
command.
117 XIts value must be a string constant
, so be careful about quoting.
118 X.IP
"-DCS_IBMPC -DCS_LATIN1 -DCS_SPECIAL"
119 XThe digraph table and flipcase option will normally start out empty.
120 XHowever
, if you add
-DCS_IBMPC or
-DCS_LATIN1 to your CFLAGS
,
121 Xthen they will start out filled with values that are appropriate
for the
122 XIBM PC character
set or the ISO Latin-1 character
set, respectively.
124 XYou can also use
-DCS_IBMPC and
-DCS_SPECIAL together to get digraphs
125 Xthat produce the PC
's graphic characters.
126 X.IP "-DDEBUG -DEBUG2"
127 X-DDEBUG adds the ":debug" and ":validate" commands,
128 Xand also adds many internal consistency checks.
129 XIt increases the size of the ".text" segment by about 6K.
131 X-DDEBUG2 causes a line to be appended to a file called "debug.out"
132 Xeverytime any change is made to the edit buffer.
134 XThis flag removes some non-critical code, so that \*E is smaller.
135 XFor example, it removes a short-cut from the regexp package, so that
136 Xtext searches are slower.
137 XAlso, screen updates are not as efficient.
138 XA couple of obscure features are disabled by this, too.
140 XThis removes the ":mkexrc" command,
141 Xso you have to create any .exrc files manually.
142 XThe size of the .text segment will be reduced by about 600 bytes.
144 XPermanently disables the charattr option.
145 XThis reduces the size of your ".text" segment by about 850 bytes.
147 XNormally, \*E will recycle space (from the temporary file) which contains
148 Xtotally obsolete text.
149 XThis flag disables this recycling.
150 XWithout recycling, the ".text" segment is about 1K smaller
151 Xthan it would otherwise be,
152 Xbut the tmp file grows much faster.
153 XIf you have a lot of free space on your hard disk,
154 Xbut \*E is too bulky to run with recycling,
155 Xthen try it without recycling.
157 XWhen using a version of \*E that has been compiled with -DNO_RECYCLE,
158 Xyou should be careful to avoid making many small changes to a file
159 Xbecause each individual change will cause the tmp file to grow by at least 1k.
160 XHitting "x" thirty times counts as thirty changes,
161 Xbut typing "30x" counts as one change.
162 XAlso, you should occasionally do a ":w" followed by a ":e" to start with a
165 XInterestingly, the real vi never recycles space from its temporary file.
167 XLeaves out the "(" and ")" visual mode commands.
168 XAlso, the "[[", "]]", "{", and "}" commands will not recognize *roff macros.
169 XThe sections and paragraphs options go away.
170 XThis saves about 650 bytes in the ".text" segment.
172 XLeaves out the visual commands which locate a given character
173 Xin the current line:
174 X"f", "t", "F", "T", "," and ";".
175 XThis saves about 900 bytes.
177 XLeaves out the "K" and "#" visual commands.
178 XAlso, the arrow keys will no longer work in input mode.
179 XRegular expressions will no longer recognize the \\{\\} operator.
180 X(Other extensions are either inherent in the design of \*E,
181 Xor are controlled by more specific flags,
182 Xor are too tiny to be worth removing.)
183 XThis saves about 250 bytes.
185 XPermanently disables the "magic" option, so that most meta-characters
186 Xin a regular expression are *NOT* recognized.
187 XThis saves about 3k of space in the ".text" segment, because
188 Xthe complex regular expression code can be replaced by much simpler code.
190 XPermanently disables the "showmode" option, saving about 250 bytes.
191 X.IP -DNO_CURSORSHAPE
192 XNormally, \*E tries to adjust the shape of the cursor as a reminder
193 Xof which mode you're
in.
194 XThe
-DNO_CURSORSHAPE flag disables this
, saving about
150 bytes.
196 XTo allow entry of non-ASCII characters
, \
*E supports digraphs.
197 XA digraph is a single
(non-ASCII
) character
which is entered as a
198 Xcombination of two other
(ASCII
) characters.
199 XIf you don
't need to input non-ASCII characters,
200 Xor if your keyboard supports a better way of entering non-ASCII characters,
201 Xthen you can disable the digraph code and save about 450 bytes.
203 X\*E adds a ":errlist" command, which is useful to programmers.
204 XIf you don't need this feature
, you can disable it via the
-DNO_ERRLIST flag.
205 XThis will reduce the .text segment by about
900 bytes
, and the .bss segment
208 XThe
-DNO_ABBR flag disables the
":abbr" command,
209 Xand reduces the size of \
*E by about
250 bytes.
211 XWhen \
*E displays the current options settings via the
":set" command,
212 Xthe options are normally sorted into columns.
213 XThe
-DNO_OPTCOLS flag causes the options to be sorted across the rows
,
214 Xwhich is much simpler
for the computer.
215 XThe
-DNO_OPTCOLS flag will reduce the size of your .text segment by about
218 XThis removes all support
for modelines.
220 XThis disables tag lookup.
221 XIt reduces the size of the .text segment by about
750 bytes.
222 X.IP
"-DNO_ALT_FKEY -DNO_CTRL_FKEY -DNO_SHIFT_FKEY -DNO_FKEY"
223 XThese remove explicit support of
function keys.
224 X-DNO_ALT_FKEY removes support
for the
<alternate
> versions
function keys.
225 X-DNO_CTRL_FKEY removes support
for the
<control
> and
<alternate
> versions
function keys.
226 X-DNO_SHIFT_FKEY removes support
for the
<shift>, <control
>, and
<alternate
> versions
function keys.
227 X-DNO_FKEY removes all support of
function keys.
229 X\
*E
's ":map" command normally allows you to use the special sequence "#<n>"
230 Xto map function key <n>.
231 XFor example, ":map #1 {!}fmt^M" will cause the <F1> key to reformat a paragraph.
232 X\*E checks the :k1=: field in the termcap description of your terminal
233 Xto figure out what code is sent by the <F1> key.
234 XThis is handy because it allows you to create a .exrc file which maps function
235 Xkeys the same way regardless of what type of terminal you use.
237 XThat behaviour is standard; most implementations of the real vi supports it too.
238 X\*E extends this to allow you to use "#1s" to refer to <shift>+<F1>,
239 X"#1c" to refer to <control>+<F1>, and
240 X"#1a" to refer to <alt>+<F1>.
241 XThe termcap description for the terminal should have fields named
242 X:s1=:c1=:a1=: respectively, to define the code sent by these key conbinations.
243 X(You should also have :k2=:s2=:c2=:a2=: for the <F2> key, and so on.)
245 XBut there may be problems.
246 XThe terminfo database doesn't support
:s1
=:c1
=:a1
=:, so no terminfo terminal
247 Xdescription could ever support shift
/control
/alt
function keys
;
248 Xso you might as well add
-DNO_SHIFT_FKEY to CFLAGS
if you
're using terminfo.
250 XNote that, even if you have -DNO_FKEYS, you can still configure \*E to use
251 Xyour function keys my mapping the literal character codes sent by the key.
252 XYou just couldn't
do it
in a terminal-independent way.
254 X.IP
"-DTERM_AMIGA -DTERM_VT100 -DTERM_VT52 etc."
255 XThe tinytcap.c
file contains descriptions of several terminal types.
256 XFor each system that uses tinytcap
, a reasonable subset of the available
257 Xdescriptions is actually compiled into \
*E.
258 XIf you wish to enlarge this subset
, then you can add the appropriate
-DTERM_XXX
259 Xflag to your CFLAGS settings.
261 XFor a list of the available terminal types
, check the tinytcap.c
file.
263 XNormally
, \
*E uses the
"ref" program to perform tag lookup.
264 XThis is
more powerful than the real vi
's tag lookup,
265 Xbut it can be much slower.
267 XIf you add -DINTERNAL_TAGS to your CFLAGS setting,
268 Xthen \* will use its own internal tag lookup code, which is faster.
269 X.IP -DPRSVDIR=\fIdirectory\fR
270 XThis controls where preserved files will be placed.
271 XAn appropriate default has been chosen for each Operating System,
272 Xso you probably don't need to worry about it.
273 X.IP
-DFILEPERMS=\fInumber
\fR
274 XThis affects the attributes of files that are created by \
*E
;
275 Xit is used as the second argument to the creat
() function.
276 XThe default is
0666 which (on UNIX systems
at least
) means that
277 Xanybody can
read or
write the new
file, but nobody can execute it.
278 XOn UNIX systems
, the creat
() call modifies this via the
umask setting.
279 X.IP
-DKEYBUFSIZE=\fInumber
\fR
280 XThis determines the size of the type-ahead buffer that elvis uses.
281 XIt also limits the size of keymaps that it can handle.
282 XThe default is
1000 characters
, which should be plenty.
285 sed '/^X/s///' > cutbufs.ms
<< '/'
288 XWhen \
*E deletes text
, it stores that text
in a cut buffer.
289 XThis happens
in both visual mode and EX mode.
290 XThere is no practical limit to how much text a cut buffer can hold.
292 XThere are
36 cut buffers
:
293 X26 named buffers
("a through "z
),
294 X9 anonymous buffers
("1 through "9),
295 Xand
1 extra cut buffer
(".).
297 XIn EX mode, the :move and :copy commands use a cut buffer to temporarily
298 Xhold the text to be moved/copied.
300 XPutting text into a Cut Buffer
302 XIn visual mode, text is copied into a cut buffer when you use the
303 Xd, y, c, C, s, or x commands.
304 XThere are also a few others.
306 XBy default, the text goes into the "1 buffer.
307 XThe text that used to be
in "1 gets shifted into "2,
308 X
"2 gets shifted into "3, and so on.
309 XThe text that used to be
in "9 is lost.
310 XThis way, the last 9 things you deleted are still accessible.
312 XYou can also put the text into a named buffer -- "a through
"z.
313 XTo do this, you should type the buffer's name
314 X(two keystrokes: a double-quote and a lowercase letter)
315 Xbefore the command that will cut the text.
316 XWhen you do this, "1 through
"9 are not affected by the cut.
318 XYou can append text to one of the named buffers.
319 XTo do this, type the buffer's name in uppercase
320 X(a double-quote and an uppercase letter)
321 Xbefore the d/y/c/C/s/x command.
323 XThe ". buffer is special.
324 XIt isn
't affected by the d/y/c/C/s/x command.
325 XInstead, it stores the text that you typed in
326 Xthe last time you were in input mode.
327 XIt is used to implement the . visual command,
328 Xand ^A in input mode.
330 XIn EX mode (also known as colon mode),
331 Xthe :delete, :change, and :yank commands all copy text into a cut buffer.
332 XLike the visual commands, these EX commands normally use the "1 buffer,
333 Xbut you can use one of the named buffers by giving its name after the command.
340 Xwill copy lines 20 through 30 into cut buffer "a.
342 XYou can't directly put text into the
". buffer, or the "2 through
"9 buffers.
344 XPasting from a Cut Buffer
346 XThere are two styles of pasting:
347 Xline-mode and character-mode.
348 XIf a cut buffer contains whole lines (from a command like "dd")
349 Xthen line-mode pasting is used;
350 Xif it contains partial lines (from a command like "dw
")
351 Xthen character-mode pasting is used.
352 XThe EX commands always cut whole lines.
354 XCharacter-mode pasting causes the text to be inserted into the line that
357 XLine-mode pasting inserts the text on a new line above or below the line
358 Xthat the cursor is on.
359 XIt doesn't affect the cursor's line at all.
361 XIn visual mode, the p and P commands insert text from a cut buffer.
362 XUppercase P will insert it before the cursor,
363 Xand lowercase p will insert it after the cursor.
364 XNormally, these commands will paste from the "1 buffer
, but you can
365 Xspecify any other buffer to
paste from.
366 XJust
type its name
(a double-quote and another character
)
367 Xbefore you
type the P or p.
369 XIn EX mode
, the
(pu
)t
command pastes text after a given line.
370 XTo
paste from a buffer other that
"1,
371 Xenter its name after the command.
375 XThe contents of a named cut buffer can be executed as a series of
378 XTo put the instructions into the cut buffer, you must first insert
379 Xthem into the file, and then delete them into a named cut buffer.
381 XTo execute a cut buffer's contents as EX commands,
382 Xyou should give the EX command "@
" and the name of the buffer.
383 XFor example, :@z will execute "z as a series of EX commands.
385 XTo execute a cut buffer
's contents as visual commands,
386 Xyou should give the visual command "@" and the letter of the buffer's name.
387 XThe visual
"@" command is different from the EX
"@" command.
388 XThey interpret the cut buffer
's contents differently.
390 XThe visual @ command can be rather finicky.
391 XEach character in the buffer is interpretted as a keystroke.
392 XIf you load the instructions into the cut buffer via a "zdd command,
393 Xthen the newline character at the end of the line will be executed just
394 Xlike any other character, so the cursor would be moved down 1 line.
395 XIf you don't want the cursor to move down
1 line
at the end of each
396 X@z
command, then you should load the cut buffer by saying
0"zD instead.
398 XAlthough cut buffers can hold any amount of text,
399 X\*E can only \fIexecute\fR small buffers.
400 XThe size limit is roughly 1000 characters, for either EX macros or VI macros.
401 XIf a buffer is too large to execute, an error message is displayed.
403 XYou can't nest :@ commands.
404 XYou can't run :@ commands from your .exrc file,
405 Xor any other :source file either.
406 XSimilarly, you can't run a :source command from within an @ command.
407 XHopefully, these restrictions will be lifted in a later version.
409 XThe Effect of Switching Files
411 XWhen \*E first starts up, all cut buffers are empty.
412 XWhen you switch to a different file
413 X(via the :n or :e commands perhaps)
414 Xthe 9 anonymous cut buffers are emptied again,
415 Xbut the other 27 buffers ("a through
"z, and ".
) retain their text.
418 sed '/^X/s///' > differ.ms
<< '/'
419 X.Go
7 "DIFFERENCES BETWEEN \*E & BSD VI/EX"
421 X\
*E is not
100% compatible with the real vi
/ex.
422 X\
*E has many small extensions
, some omissions
, and a few features
which
423 Xare implemented
in a slightly different manner.
426 X.IP
"Save Configuration" 1i
427 XThe
:mkexrc
command saves the current
:set and
:map configurations
in
428 Xthe
".exrc" file in your current directory.
429 X.IP
"Previous File" 1i
430 XThe
:N or
:prev
command moves backwards through the args list.
431 X.IP
"Center Current Row" 1i
432 XIn visual
command mode
, the
(lowercase
) "zz" command will center the current
433 Xline on the screen
, like
"z=".
434 X.IP
"Changing Repeat Count" 1i
435 XThe default count value
for . is the same as the previous
command
436 Xwhich . is meant to repeat.
437 XHowever
, you can supply a new count
if you wish.
438 XFor example
, after
"3dw", "." will delete
3 words
,
439 Xbut
"5." will delete
5 words.
440 X.IP
"Previous Text" 1i
441 XThe text
which was most recently input
442 X
(via a
"cw" command, or something similar
)
443 Xis saved
in a cut buffer called
". (which
444 Xis a pretty hard name to write in an English sentence).
445 X.IP "Keyword Lookup
" 1i
446 XIn visual command mode, you can move the cursor onto a word and press
447 Xshift-K to have \*E run a reference program to look that word up.
448 XThis command alone is worth the price of admission!
449 XSee the ctags and ref programs.
450 X.IP "Increment
/Decrement
" 1i
451 XIn visual command mode, you can move the cursor onto a number and
452 Xthen hit ## or #+ to increment that number by 1.
453 XTo increment it by a larger amount,
454 Xtype in the increment value before hitting the initial #.
455 XThe number can also be decremented or set by hitting #- or #=, respectively.
457 XYou can backspace past the beginning of the line.
459 XThe arrow keys work in input mode.
461 XIf you type control-A, then the text that you input last time is inserted.
462 XYou will remain in input mode, so you can backspace over part of it,
464 X(This is sort of like control-@ on the real vi,
465 Xexcept that control-A really works.)
467 XControl-P will insert the contents of the cut buffer.
469 XReal vi can only remember up to 128 characters of input,
470 Xbut \*E can remember any amount.
472 XThe ^T and ^D keys can adjust the indent of a line no matter where
473 Xthe cursor happens to be in that line.
475 XYou can save your file and exit \*E directly from input mode by hitting
478 X\*E supports digraphs as a way to enter non-ASCII characters.
479 X.IP "Start
in Input Mode
" 1i
480 XIf you ":set inputmode
" in your .exrc file, then \*E will start up in
481 Xinput mode instead of visual command mode.
482 X.IP "Visible Fonts
" 1i
483 XWith ":set charattr
", \*E can display "backslash-f
" style character attributes on the
485 XThe following example shows the recognized atributes:
488 Xnormal \\fBboldface\\fR \\fIitalics\\fR \\fUunderlined\\fR normal
490 XNOTE: you must compile \*E without the -DNO_CHARATTR flag for
492 X.IP "File Syncing
" 1i
493 XAfter a crash, you can usually recover the altered form of the file
494 Xfrom the temporary file that \*E uses -- unless the temporary file was
497 XUNIX systems use a delayed-write cache, which means that when \*E tries to
498 Xwrite to the temporary file, the information might still be in RAM instead
500 XA power failure at that time would cause the in-RAM information to be lost.
501 XUNIX's sync() call will force all such information to disk.
503 XMS-DOS and Atari TOS don't write a file's length to disk until that file
505 XConsequently, the temporary file would appear to be 0 bytes long if power
506 Xfailed when we were editing.
507 XTo avoid this problem, a sync() function has been written which will close
508 Xthe temporary file and then immediately reopen it.
509 X.IP "Cursor Shape
" 1i
510 X\*E changes the shape of the cursor to indicate which mode you're in,
511 Xif your terminal's termcap entry includes the necessary capabilities.
512 X.IP "Hide nroff Lines
" 1i
513 XTh ":set hideformat
" option hides nroff format control lines.
514 X(They are displayed on the screen as blank lines.)
516 X.IP "Compiler Interface
" 1i
517 X\*E is clever enough to parse the error messages emitted by many compilers.
518 XTo use this feature,
519 Xyou should collect your compiler's error messages into a file called "errlist
";
520 X\*E will read this file,
521 Xdetermine which source file caused the error messages,
522 Xstart editing that file,
523 Xmove the cursor to the line where the error was detected,
524 Xand display the error message on the status line.
526 X.IP "Visible Text Selection
" 1i
527 XIn visual command mode, 'v' starts visibly selecting characters and
528 X\&'V' starts visibly selecting whole lines.
529 XThe character or line where the cursor is located becomes one
530 Xendpoint of the selection.
531 XYou can then use the standard cursor movement commands to move the cursor
532 Xto the other endpoint, and then press one of the operator commands
534 XThe operator will then immediately be applied to the selected text.
535 X.IP "Pop-up Menu Operator
" 1i
536 XThe '\\' key is a new operator,
537 Xsimilar in operation to the c/d/y/</>/! operators
538 XIt conjures up a menu, from which you can select any of the other
539 Xoperators plus a few other common commands.
540 X.IP "Preset Filter Operator
" 1i
541 XThe '=' key is another new operator.
542 XIt is similar to the '!' operator, except that while
543 X\&'!' asks you to type in a filter command each time,
544 X\&'=' assumes it should always run the command stored in the \fIequalprg\fR option.
545 X.IP "Move to a Given Percentage
" 1i
546 XThe '%' movement key can now accept an optional count.
547 XWithout a count, the '%' key still moves to a matching parenthesis
549 XWith a count somewhere between 1 and 100, though, it moves the cursor to
550 Xapproximately a given percentage of the way through the file.
551 XFor example, typing "50%" will move the cursor to the middle of the file.
552 X.IP "Regular Expressions
"
553 XIn regular expressions, several new forms of closure operators are supported:
554 X\\{\fIn\fR}, \\{\fIn\fR,\fIm\fR}, \\+, and \\?.
558 XThe replace mode is a hack.
559 XIt doesn't save the text that it overwrites.
561 XLong lines are displayed differently -- where the real vi would
562 Xwrap a long line onto several rows of the screen, \*E simply
563 Xdisplays part of the line, and allows you to scroll the screen
564 Xsideways to see the rest of it.
566 XThe ":preserve
" and ":recover
" commands are missing.
568 XI've never had a good reason to use ":preserve
",
569 Xand since ":recover
" is used so rarely
570 XI decided to implement it as a separate program.
571 XThere's no need to load the recovery code into memory every
572 Xtime you edit a file, I figured.
574 XLISP support is missing.
575 XHowever, the = key is still an operator that reformats lines of text.
576 XBy default, it reformats lines by sending them through the \fIfmt\fP filter,
577 Xbut you could write your own LISP beautifier and configure elvis to use it.
578 XKey mappings could take care of most other differences.
579 XAuto-indent is the only thing that is irrecoverably lost.
581 XAutoindent mode acts a little different from the real vi, anyway.
582 XIt doesn't handle ^^D or 0^D correctly.
583 XOn the other hand, it \fIdoes\fP allow ^D and ^T to be used anywhere in the
584 Xline, to adjust the indentation for the whole line.
587 sed '/^X/s///' > environ.ms << '/'
588 X.Go 11 "ENVIRONMENT VARIABLES
"
590 X\*E examines several environment variables when it starts up.
591 XThe values of these variables are used internally for a variety
593 XYou don't need to define all of these;
594 Xon most systems, \*E only requires TERM to be defined.
595 XOn AmigaDOS, MS-DOS or TOS systems, even that is optional.
599 XTERM tells \*E the name of the termcap entry to use.
600 XTERMCAP may contain either the entire termcap entry,
601 Xor the full pathname of the termcap file to search through.
603 XIf your version of \*E is using tinytcap instead of the full termcap library,
604 Xthen the value of TERMCAP \fIcannot\fR contain any backslash escapes (\\E, \\r, etc.)
605 Xor carat escapes (^[, ^M, etc.), because tinytcap doesn't understand them.
606 XInstead, you should embed the actual control character into the string.
610 XThese only work for AmigaDOS, MS-DOS and Atari TOS.
611 XEither of these variables may be used to set the "directory
" option,
612 Xwhich controls where temporary files are stored.
613 XIf you define them both, then TMP is used, and TEMP is ignored.
617 XThe termcap entry for your terminal should specify the size of your screen.
618 XIf you're using a windowing interface, then there is an ioctl() call which
619 Xwill provide the size of the window; the ioctl() values will override the
620 Xvalues in the termcap entry.
621 XThe LINES and COLUMNS environment variables (if defined)
622 Xwill override either of these sources.
623 XThey, in turn, can be overridden by a ":set" command.
625 XNormally, the LINES and COLUMNS variables shouldn't need to be defined.
629 XThis variable's value may contain one or more colon-mode commands,
630 Xwhich will be executed after all of the ".exrc
" files
631 Xbut before interactive editing begins.
633 XTo put more than one command in EXINIT, you can separate the commands
634 Xwith either a newline or a '|' character.
638 XYou can use COMSPEC in MS-DOS, or SHELL in any other system,
639 Xto specify which shell should be used for executing commands and
640 Xexpanding wildcards.
644 XThis variable should give the full pathname of your home directory.
645 X\*E needs to know the name of your home directory so it can locate
646 Xthe ".exrc
" file there.
650 XThis variable is used by the "ref
" program.
651 XIt contains a list of directories that might contain a relevent "tags
" file.
652 XUnder AmigaDOS, MS-DOS or Atari TOS, the names of the directories should be separated by
654 XUnder other operating systems, the names should be separated by colons (":").
656 XIf you don't define TAGPATH, then "ref
" will use a default list which includes
657 Xthe current directory and a few other likely places.
658 XSee the definition of DEFTAGPATH at the start of ref.c for an accurate list.
661 sed '/^X/s///' > ex.ms << '/'
662 X.Go 3 "COLON MODE COMMANDS
"
667 X.\" NOTE: The following macro is used to output a single line of the
668 X.\" command chart. Its usage is:
670 X.\" .Cm <linespecs> <name> <arguments>...
673 X.if "\\$1"0" \t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
674 X.
if "\\$1"1" \s-2[line]\s+2\t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
675 X.if "\\$1"2" \s-2
[line
][,line
]\s
+2\t\\$2\t\\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
681 X\s
+2LINES COMMAND ARGUMENTS\s-2
682 X.Cm
0 ab
[br
] [short
] [expanded form
]
684 X.Cm
0 ar[gs
] [files
]
686 X.Cm
0 cd[!] [directory
]
688 X.Cm
0 chd
[ir
][!] [directory
]
690 X.Cm
0 col[or
] [when
] [[\
*Qlight\
*U
] color
] [\
*Qon\
*U color
]
691 X.Cm
2 d
[elete
] [\
*Ux
]
692 X.Cm
0 dig[raph
][!] [XX
[Y
]]
693 X.Cm
0 e
[dit
][!] [file]
694 X.Cm
0 er
[rlist
][!] [errlist
]
696 X.Cm
2 g
[lobal
] /regexp
/ command
700 X.Cm
0 mak
[e
] [target
]
701 X.Cm
0 map
[!] key mapped_to
705 X.Cm
0 n
[ext
][!] [files
]
713 X.Cm
0 se
[t
] [options
]
715 X.Cm
2 s
[ubstitute
] /regexp
/replacement
/[p
][g
][c
]
716 X.Cm
0 ta
[g
][!] tagname
717 X.Cm
0 una
[bbr
] [short
]
719 X.Cm
0 unm
[ap
][!] key
721 X.Cm
2 v
[global
] /regexp
/ command
722 X.Cm
0 vi
[sual
] [filename
]
724 X.Cm
2 w
[rite
][!] [[>>]file]
736 XTo use colon mode commands
, you must switch from visual
command
737 Xmode to colon
command mode.
738 XThe visual mode commands to
do this are
":" for a single colon
command,
739 Xor
"Q" for many colon mode commands.
743 XLine specifiers are always optional.
744 XThe first line specifier of most commands usually defaults to the current line.
745 XThe second line specifier usually defaults to be the same
746 Xas the first line specifier.
747 XExceptions are
:write, :global
, and
:vglobal
, which act on all lines of the
748 Xfile by default
, and
:!, which acts on no lines by default.
750 XLine specifiers consist of an absolute part and a relative part.
751 XThe absolute part of a line specifier may be either an explicit line number
,
752 Xa mark
, a dot to denote the current line
, a dollar sign to denote the last
753 Xline of the
file, or a forward or backward search.
755 XAn explicit line number is simply a decimal number
, expressed as a
758 XA mark is typed
in as an apostrophe followed by a letter.
759 XMarks must be
set before they can be used.
760 XYou can
set a mark
in visual
command mode by typing
"m" and a letter
,
761 Xor you can
set it
in colon
command mode via the
"mark" command.
763 XA forward search is typed
in as a regular expression surrounded by
764 Xslash characters
; searching begins
at the default line.
765 XA backward search is typed
in as a regular expression surrounded by
766 Xquestion marks
; searching begins
at the line before the default line.
768 XIf you omit the absolute part
, then the default line is used.
770 XThe relative part of a line specifier is typed as a
"+" or
"-" character
771 Xfollowed by a decimal number.
772 XThe number is added to or subtracted from the absolute part
773 Xof the line specifier to produce the final line number.
775 XAs a special
case, the
% character may be used to specify all lines of the
file.
776 XIt is roughly equivelent to saying
1,$.
777 XThis can be a handy shortcut.
783 X
:p print the current line
785 X
:'gp print the line which contains mark g
786 X :/foo/p print the next line that contains "foo"
787 X :$p print the last line of the file
788 X :20,30p print lines 20 through 30
789 X :1,$p print all lines of the file
790 X :%p print all lines of the file
791 X :/foo/-2,+4p print 5 lines around the next "foo"
800 X[line][,line] change ["x]
804 XThe \fBa\fRppend command inserts text after the specified line.
806 XThe \fBi\fRnsert command inserts text before the specified line.
808 XThe \fBc\fRhange command copies the range of lines into a cut buffer,
809 Xdeletes them, and inserts new text where the old text used to be.
811 XFor all of these commands, you indicate the end of the text you're
812 Xinserting by hitting ^D or by entering a line
which contains only a
815 XCut
& Paste Commands
819 X
[line
][,line
] delete
["x]
820 X[line][,line] yank ["x
]
822 X[line][,line] copy line
823 X[line][,line] to line
824 X[line][,line] move line
827 XThe \fBd\fRelete command copies the specified range of lines into a
828 Xcut buffer, and then deletes them.
830 XThe \fBy\fRank command copies the specified range of lines into a cut
831 Xbuffer, but does *not* delete them.
833 XThe \fBpu\fRt command inserts text from a cut buffer after the
836 XThe \fBco\fRpy and \fBt\fRo commands yank the specified range of lines and
837 Xthen immediately paste them after some other line.
839 XThe \fBm\fRove command deletes the specified range of lines and then
840 Ximmediately pastes them after some other line.
841 XIf the destination line comes after the deleted text,
842 Xthen it will be adjusted automatically to account for the deleted lines.
844 XDisplay Text Commands
850 X[line][,line] number
853 XThe \fBp\fRrint command displays the specified range of lines.
855 XThe \fBnu\fRmber command displays the lines, with line numbers.
857 XThe \fBl\fRist command also displays them, but it is careful to make
858 Xcontrol characters visible.
860 XGlobal Operations Commands
864 X[line][,line] global /regexp/ command
865 X[line][,line] vglobal /regexp/ command
868 XThe \fBg\fRlobal command searches through the lines of the specified range
869 X(or through the whole file if no range is specified)
870 Xfor lines that contain a given regular expression.
871 XIt then moves the cursor to each of these lines and
872 Xruns some other command on them.
874 XThe \fBv\fRglobal command is similar, but it searches for lines that \fIdon't\fR
875 Xcontain the regular expression.
877 XLine Editing Commands
881 X[line][,line] join[!]
882 X[line][,line] ! program
885 X[line][,line] substitute /regexp/replacement/[p][g][c]
889 XThe \fBj\fRoin command catenates all lines in the specified range together
890 Xto form one big line.
891 XIf only a single line is specified, then the following line is catenated
893 XThe normal ":join" inserts one or two spaces between the lines;
894 Xthe ":join!" variation (with a '!') doesn't insert spaces.
896 XThe \fB!\fR command runs an external filter program,
897 Xand feeds the specified range of lines to it's stdin.
898 XThe lines are then replaced by the output of the filter.
899 XA typical example would be ":'a,'z
!sort" to sort the lines 'a,'z.
901 XThe \fB<\fR and \fB>\fR commands shift the specified range of lines left or right,
902 Xnormally by the width of 1 tab character.
903 XThe "shiftwidth
" option determines the shifting amount.
905 XThe \fBs\fRubstitute command finds the regular expression in each line,
906 Xand replaces it with the replacement text.
907 XThe "p
" option causes the altered lines to be printed.
908 XThe "g
" option permits all instances of the regular expression
909 Xto be found & replaced.
910 X(Without "g
", only the first occurrence in each line is replaced.)
911 XThe "c
" option asks for confirmation before each substitution.
913 XThe \fB&\fR command repeats the previous substitution command.
914 XActually, "&" is equivelent to "s
//~
/" with the same options as last time.
915 XIt searches for the last regular expression that you specified for any purpose,
916 Xand replaces it with the the same text
917 Xthat was used in the previous substitution.
926 XThe \fBu\fRndo command restores the file to the state it was in before
927 Xyour most recent command which changed text.
929 XConfiguration & Status Commands
933 Xmap[!] [key mapped_to]
935 Xabbr [word expanded_form_of_word]
947 Xcolor [when] [["light
"] color] ["on
" color]
950 XThe \fBma\fRp command allows you to configure \*E to recognize your function keys,
951 Xand treat them as though they transmitted some other sequence of characters.
952 XNormally this mapping is done only when in the visual command mode,
953 Xbut with the [!] present it will map keys under input and replace modes as well.
954 XWhen this command is given with no arguments,
955 Xit prints a table showing all mappings currently in effect.
956 XWhen called with two arguments, the first is the sequence that your
957 Xfunction key really sends, and the second is the sequence that you want
958 X\*E to treat it as having sent.
959 XAs a special case, if the first argument is a number then \*E will map the
960 Xcorresponding function key;
961 Xfor example, ":map
7 dd" will cause the <F7> key to delete a line.
963 XThe \fBunm\fRap command removes key definitions that were made via the map command.
965 XThe \fBab\fRbr command is used to define/list a table of abbreviations.
966 XThe table contains both the abbreviated form and the fully spelled-out form.
967 XWhen you're in visual input mode, and you type in the abbreviated form,
968 X\*E will replace the abbreviated form with the fully spelled-out form.
969 XWhen this command is called without arguments, it lists the table;
970 Xwith two or more arguments, the first argument is taken as the abbreviated
971 Xform, and the rest of the command line is the fully-spelled out form.
973 XThe \fBuna\fRbbr command deletes entries from the abbr table.
975 XThe \fBdi\fRgraph command allows you to display the set of digraphs that \*E is
976 Xusing, or add/remove a digraph.
977 XTo list the set of digraphs, use the digraph command with no arguments.
978 XTo add a digraph, you should give the digraph command two arguments.
979 XThe first argument is the two ASCII characters that are to be combined;
980 Xthe second is the non-ASCII character that they represent.
981 XThe non-ASCII character's most significant bit is automatically set by the
982 Xdigraph command, unless to append a ! to the command name.
983 XRemoval of a digraph is similar to adding a digraph, except that you should
984 Xleave off the second argument.
986 XThe \fBse\fRt command allows you examine or set various options.
987 XWith no arguments, it displays the values of options that have been changed.
988 XWith the single argument "all
" it displays the values of all options,
989 Xregardless of whether they've been explicitly set or not.
990 XOtherwise, the arguments are treated as options to be set.
992 XThe \fBmk\fRexrc command saves the current configuration to a file
993 Xcalled ".exrc
" in the current directory.
995 XThe mar\fBk\fR command defines a named mark to refer to a specific place
997 XThis mark may be used later to specify lines for other commands.
999 XThe \fBvi\fRsual command puts the editor into visual mode.
1000 XInstead of emulating ex, \*E will start emulating vi.
1002 XThe \fBve\fRrsion command tells you that what version of \*E this is.
1004 XThe \fB=\fR command tells you what line you specified, or,
1005 Xif you specified a range of lines, it will tell you both endpoints and
1006 Xthe number of lines included in the range.
1008 XThe \fBf\fRile command tells you the name of the file,
1009 Xwhether it has been modified,
1010 Xthe number of lines in the file,
1011 Xand the current line number.
1012 XYou can also use it to change the name of the current file.
1014 XThe \fBso\fRurce command reads a sequence of colon mode commands from a file,
1015 Xand interprets them.
1017 XThe \fB@\fR command executes the contents of a cut-buffer as EX commands.
1019 XThe \fBcol\fRor command only works under MS-DOS, or if you have an ANSI-compatible
1021 XIt allows you to set the foreground and background colors
1022 Xfor different types of text:
1023 Xnormal, bold, italic, underlined, standout, pop-up menu, and visible selection.
1024 XBy default, it changes the "normal
" colors;
1025 Xto change other colors, the first argument to the :color command should be
1026 Xthe first letter of the type of text you want.
1027 XThe syntax for the colors themselves is fairly intuitive.
1028 XFor example, ":color light cyan on blue
" causes normal text to be displayed
1029 Xin light cyan on a blue background, and
1030 X":color b bright white
" causes bold text to be displayed in bright white on
1032 XThe background color always defaults to the current background color of
1034 XYour first :color command \fImust\fP specify both the foreground and background
1037 XMultiple File Commands
1048 XWhen you invoke \*E from your shell's command line,
1049 Xany filenames that you give to \*E as arguments are stored in the args list.
1050 XThe \fBar\fRgs command will display this list, or define a new one.
1052 XThe \fBn\fRext command switches from the current file to the next one
1054 XYou may specify a new args list here, too.
1056 XThe \fBN\fRext and \fBpre\fRvious commands
1057 X(they're really aliases for the same command)
1058 Xswitch from the current file to the preceding file in the args list.
1060 XThe \fBrew\fRind command switches from the current file to the first file
1071 XThe \fBe\fRdit command allows to switch from the current file to some other file.
1072 XThis has nothing to do with the args list, by the way.
1074 XThe \fBta\fRg command looks up a given tagname in a file called "tags
".
1075 XThis tells it which file the tag is in, and how to find it in that file.
1076 X\*E then switches to the tag's file and finds the tag.
1078 XWorking with a Compiler
1084 Xerrlist[!] [errlist]
1087 XThe \fBcc\fR and \fBmak\fRe commands execute your compiler or "make" utility
1088 Xand redirect any error messages into a file called "errlist
".
1089 XBy default, cc is run on the current file.
1090 X(You should write it before running cc.)
1091 XThe contents of the "errlist
" file are then scanned for error messages.
1092 XIf an error message is found, then the cursor is moved to the line where
1093 Xthe error was detected,
1094 Xand the description of the error is displayed on the status line.
1096 XAfter you've fixed one error, the \fBer\fRrlist command will move
1097 Xthe cursor to the next error.
1098 XIn visual command mode,
1099 Xhitting `*' will do this, too.
1101 XYou can also create an "errlist
" file from outside of \*E,
1102 Xand use "\
*E
-m" to start elvis and have the cursor moved to the
1104 XNote that you don't need to supply a filename with "\
*E
-m" because
1105 Xthe error messages always say which source file an error is in.
1108 XWhen you use errlist repeatedly to fix several errors in a single file,
1109 Xit will attempt to adjust the reported line numbers to allow for lines
1110 Xthat you have inserted or deleted.
1111 XThese adjustments are made with the assumption that you will work though
1112 Xthe file from the beginning to the end.
1123 XThe \fBq\fRuit command exits from the editor without saving your file.
1125 XThe \fBwq\fR command writes your file out, then then exits.
1127 XThe \fBx\fRit command is similar to the \fBwq\fR command, except that
1128 X\fBx\fRit won't bother to write your file if you haven't modified it.
1135 X[line][,line] write[!] [[>>]file]
1138 XThe \fBr\fRead command gets text from another file and inserts it
1139 Xafter the specified line.
1140 XIt can also read the output of a program;
1141 Xsimply precede the program name by a '!' and use it in place of the file name.
1143 XThe \fBw\fRrite command writes the whole file, or just part of it,
1144 Xto some other file.
1145 XThe !, if present, will permit the lines to be written even if you've set
1146 Xthe readonly option.
1147 XIf you precede the filename by >> then the lines will be appended to the file.
1148 XYou can send the lines to the standard input of a program by replacing the
1149 Xfilename with a '!' followed by the command and its arguments.
1151 XNote: Be careful not to confuse ":w
!filename
" and ":w
!command".
1152 XTo write to a program, you must have at least one blank before the '!'.
1163 XThe \fBcd\fR and \fBchd\fRir commands
1164 X(really two names for one command)
1165 Xswitch the current working directory.
1167 XThe \fBsh\fRell command starts an interactive shell.
1173 X[line][,line] debug[!]
1177 XThese commands are only available if you compile \*E with the -DDEBUG flag.
1179 XThe de\fBb\fRug command lists statistics for the blocks which contain
1180 Xthe specified range of lines.
1181 XIf the ! is present, then the contents of those blocks is displayed, too.
1183 XThe \fBva\fRlidate command checks certain variables for internal consistency.
1184 XNormally it doesn't output anything unless it detects a problem.
1185 XWith the !, though, it will always produce *some* output.
1188 sed '/^X/s///' > index.ms << '/'
1191 XWhat E\s-2LVIS\s+2 does,
1193 XHow to compile E\s-2LVIS\s+2,
1196 XVISUAL MODE COMMANDS
1197 XNormal interactive editing,
1204 XCOLON MODE COMMANDS
1212 XConfiguration & status,
1215 XWorking with a compiler,
1221 XREGULAR EXPRESSIONS
1233 XPutting text into a cut buffer,
1234 XPasting from a cut buffer,
1236 XThe effect of switching files
1238 XDIFFERENCES BETWEEN E\s-2LVIS\s+2 AND THE REAL VI/EX
1243 XFor programmers only,
1244 XThe temporary file,
1245 XImplementation of editing,
1246 XMarks and the cursor,
1247 XColon command interpretation,
1255 XENVIRONMENT VARIABLES
1259 XQUESTIONS & ANSWERS
1264 XUNIX-style "man
" pages appear at the end of this manual.
1266 echo x - internal.ms
1267 sed '/^X/s///' > internal.ms << '/'
1270 XYou don't need to know the material in this section to use \*E.
1271 XYou only need it if you intend to modify \*E.
1273 XYou should also check out the CFLAGS, TERMCAP, ENVIRONMENT VARIABLES,
1274 XVERSIONS, and QUIESTIONS & ANSWERS sections of this manual.
1278 XThe temporary file is divided into blocks of 1024 bytes each.
1279 XThe functions in "blk.c
" maintain a cache of the five most recently used blocks,
1280 Xto minimize file I/O.
1282 XWhen \*E starts up, the file is copied into the temporary file
1283 Xby the function \fBtmpstart()\fR in "tmp.c
".
1284 XSmall amounts of extra space are inserted into the temporary file to
1285 Xinsure that no text lines cross block boundaries.
1286 XThis speeds up processing and simplifies storage management.
1287 XThe extra space is filled with NUL characters.
1288 Xthe input file must not contain any NULs, to avoid confusion.
1289 XThis also limits lines to a length of 1023 characters or less.
1291 XThe data blocks aren't necessarily stored in sequence.
1292 XFor example, it is entirely possible that the data block containing
1293 Xthe first lines of text will be stored after the block containing the
1294 Xlast lines of text.
1296 XIn RAM, \*E maintains two lists: one that describes the "proper
"
1297 Xorder of the disk blocks, and another that records the line number of
1298 Xthe last line in each block.
1299 XWhen \*E needs to fetch a given line of text, it uses these tables
1300 Xto locate the data block which contains that line.
1302 XBefore each change is made to the file, these lists are copied.
1303 XThe copies can be used to "undo
" the change.
1304 XAlso, the first list
1305 X-- the one that lists the data blocks in their proper order --
1306 Xis written to the first data block of the temp file.
1307 XThis list can be used during file recovery.
1309 XWhen blocks are altered, they are rewritten to a \fIdifferent\fR block in the file,
1310 Xand the order list is updated accordingly.
1311 XThe original block is left intact, so that "undo
" can be performed easily.
1312 X\*E will eventually reclaim the original block, when it is no longer needed.
1314 XImplementation of Editing
1316 XThere are three basic operations which affect text:
1318 X\(bu delete text - delete(from, to)
1319 X\(bu add text - add(at, text)
1320 X\(bu yank text - cut(from, to)
1323 XTo yank text, all text between two text positions is copied into a cut buffer.
1324 XThe original text is not changed.
1325 XTo copy the text into a cut buffer,
1326 Xyou need only remember which physical blocks that contain the cut text,
1327 Xthe offset into the first block of the start of the cut,
1328 Xthe offset into the last block of the end of the cut,
1329 Xand what kind of cut it was.
1330 X(Cuts may be either character cuts or line cuts;
1331 Xthe kind of a cut affects the way it is later "put
".)
1332 XYanking is implemented in the function \fBcut()\fR,
1333 Xand pasting is implemented in the function \fBpaste()\fR.
1334 XThese functions are defined in "cut.c
".
1336 XTo delete text, you must modify the first and last blocks, and
1337 Xremove any reference to the intervening blocks in the header's list.
1338 XThe text to be deleted is specified by two marks.
1339 XThis is implemented in the function \fBdelete()\fR.
1341 XTo add text, you must specify
1342 Xthe text to insert (as a NUL-terminated string)
1343 Xand the place to insert it (as a mark).
1344 XThe block into which the text is to be inserted may need to be split into
1345 Xas many as four blocks, with new intervening blocks needed as well...
1346 Xor it could be as simple as modifying a single block.
1347 XThis is implemented in the function \fBadd()\fR.
1349 XThere is also a \fBchange()\fR function,
1350 Xwhich generally just calls delete() and add().
1351 XFor the special case where a single character is being replaced by another
1352 Xsingle character, though, change() will optimize things somewhat.
1353 XThe add(), delete(), and change() functions are all defined in "modify.c
".
1355 XThe \fBinput()\fR function reads text from a user and inserts it into the file.
1356 XIt makes heavy use of the add(), delete(), and change() functions.
1357 XIt inserts characters one at a time, as they are typed.
1359 XWhen text is modified, an internal file-revision counter, called \fBchanges\fR,
1361 XThis counter is used to detect when certain caches are out of date.
1362 X(The "changes
" counter is also incremented when we switch to a different file,
1363 Xand also in one or two similar situations -- all related to invalidating caches.)
1365 XMarks and the Cursor
1367 XMarks are places within the text.
1368 XThey are represented internally as 32-bit values which are split
1369 Xinto two bitfields:
1370 Xa line number and a character index.
1371 XLine numbers start with 1, and character indexes start with 0.
1372 XLines can be up to 1023 characters long, so the character index is 10 bits
1373 Xwide and the line number fills the remaining 22 bits in the long int.
1375 XSince line numbers start with 1,
1376 Xit is impossible for a valid mark to have a value of 0L.
1377 X0L is therefore used to represent unset marks.
1379 XWhen you do the "delete text
" change, any marks that were part of
1380 Xthe deleted text are unset, and any marks that were set to points
1381 Xafter it are adjusted.
1382 XMarks are adjusted similarly after new text is inserted.
1384 XThe cursor is represented as a mark.
1386 XColon Command Interpretation
1388 XColon commands are parsed, and the command name is looked up in an array
1389 Xof structures which also contain a pointer to the function that implements
1390 Xthe command, and a description of the arguments that the command can take.
1391 XIf the command is recognized and its arguments are legal,
1392 Xthen the function is called.
1394 XEach function performs its task; this may cause the cursor to be
1395 Xmoved to a different line, or whatever.
1399 XIn input mode or visual command mode,
1400 Xthe screen is redrawn by a function called \fBredraw()\fR.
1401 XThis function is called in the getkey() function before each keystroke is
1402 Xread in, if necessary.
1404 XRedraw() write to the screen via a package which looks like the "curses
"
1405 Xlibrary, but isn't.
1406 XIt is actually much simpler.
1407 XMost curses operations are implemented as macros which copy characters
1408 Xinto a large I/O buffer, which is then written with a single large
1409 Xwrite() call as part of the refresh() operation.
1411 X(Note: Under MS-DOS, the pseudo-curses macros check to see whether you're
1412 Xusing the pcbios interface. If you are, then the macros call functions
1413 Xin "pc.c
" to implement screen updates.)
1415 XThe low-level functions which modify text (namely add(), delete(), and change())
1416 Xsupply redraw() with clues to help redraw() decide which parts of the
1417 Xscreen must be redrawn.
1418 XThe clues are given via a function called \fBredrawrange()\fR.
1420 XMost EX commands use the pseudo-curses package to perform their output,
1423 XThere is also a function called \fBmsg()\fR which uses the same syntax as printf().
1424 XIn EX mode, msg() writes message to the screen and automatically adds a
1426 XIn VI mode, msg() writes the message on the bottom line of the screen
1427 Xwith the "standout
" character attribute turned on.
1431 XFor each option available through the ":set" command,
1432 X\*E contains a character array variable, named "o_
\fIoption
\fR
".
1433 XFor example, the "lines
" option uses a variable called "o_lines
".
1435 XFor boolean options, the array has a dimension of 1.
1436 XThe first (and only) character of the array will be NUL if the
1437 Xvariable's value is FALSE, and some other value if it is TRUE.
1438 XTo check the value, just by dereference the array name,
1439 Xas in "if (*o_autoindent
)".
1441 XFor number options, the array has a dimension of 3.
1442 XThe array is treated as three unsigned one-byte integers.
1443 XThe first byte is the current value of the option.
1444 XThe second and third bytes are the lower and upper bounds of that
1447 XFor string options, the array usually has a dimension of about 60
1449 XThe option's value is stored as a normal NUL-terminated string.
1451 XAll of the options are declared in "opts.c
".
1452 XMost are initialized to their default values;
1453 Xthe \fBinitopts()\fR function is used to perform any environment-specific
1458 XTo improve portability, \*E collects as many of the system-dependent
1459 Xdefinitions as possible into the "config.h
" file.
1460 XThis file begins with some preprocessor instructions which attempt to
1461 Xdetermine which compiler and operating system you have.
1462 XAfter that, it conditionally defines some macros and constants for your system.
1464 XOne of the more significant macros is \fBttyread()\fR.
1465 XThis macro is used to read raw characters from the keyboard, possibly
1467 XFor UNIX systems, this basically reads bytes from stdin.
1468 XFor MSDOS, TOS, and OS9, ttyread() is a function defined in curses.c.
1469 XThere is also a \fBttywrite()\fR macro.
1471 XThe \fBtread()\fR and \fBtwrite()\fR macros are versions of read() and write() that are
1472 Xused for text files.
1473 XOn UNIX systems, these are equivelent to read() and write().
1474 XOn MS-DOS, these are also equivelent to read() and write(),
1475 Xsince DOS libraries are generally clever enough to convert newline characters
1477 XFor Atari TOS, though, the MWC library is too stupid to do this,
1478 Xso we had to do the conversion explicitly.
1480 XOther macros may substitute index() for strchr(), or bcopy() for memcpy(),
1481 Xor map the "void
" data type to "int
", or whatever.
1483 XThe file "tinytcap.c
" contains a set of functions that emulate the termcap
1484 Xlibrary for a small set of terminal types.
1485 XThe terminal-specific info is hard-coded into this file.
1486 XIt is only used for systems that don't support real termcap.
1487 XAnother alternative for screen control can be seen in
1488 Xthe "curses.h
" and "pc.c
" files.
1489 XHere, macros named VOIDBIOS and CHECKBIOS are used to indirectly call
1490 Xfunctions which perform low-level screen manipulation via BIOS calls.
1492 XThe stat() function must be able to come up with UNIX-style major/minor/inode
1493 Xnumbers that uniquely identify a file or directory.
1495 XPlease try to keep you changes localized,
1496 Xand wrap them in #if/#endif pairs,
1497 Xso that \*E can still be compiled on other systems.
1498 XAnd PLEASE let me know about it, so I can incorporate your changes into
1499 Xmy latest-and-greatest version of \*E.
1502 sed '/^X/s///' > intro.ms << '/'
1503 X.Go 1 "INTRODUCTION
"
1505 X\*E is a clone of vi/ex, the standard UNIX editor.
1506 X\*E supports nearly all of the vi/ex commands,
1507 Xin both visual mode and colon mode.
1509 XLike vi/ex, \*E stores most of the text in a temporary file, instead of RAM.
1510 XThis allows it to edit files that are too large to fit
1511 Xin a single process' data space.
1512 XAlso, the edit buffer can survive a power failure or crash.
1514 X\*E runs under BSD UNIX, AT&T SysV UNIX, Minix, MS-DOS, Atari TOS,
1515 XCoherent, OS9/68000, VMS and AmigaDos.
1516 XThe next version is also expected to add MS-Windows, OS/2 and MacOS.
1517 XContact me before you start porting it to some other OS,
1518 Xbecause somebody else may have already done it for you.
1520 X\*E is freely redistributable, in either source form or executable form.
1521 XThere are no restrictions on how you may use it.
1525 XSee the "Versions
" section of this manual for instructions on how to compile
1528 XIf you want to port \*E to another O.S. or compiler, then
1529 Xyou should start be reading the "Portability
" part of the "Internal
" section.
1533 XThe user interface of \*E/vi/ex is weird.
1534 XThere are two major command modes in \*E, and a few text input modes as well.
1535 XEach command mode has a command which allows you to switch to the other mode.
1537 XYou will probably use the \fIvisual command mode\fR
1539 XThis is the mode that \*E normally starts up in.
1541 XIn visual command mode, the entire screen is filled with lines of text
1543 XEach keystroke is interpretted as part of a visual command.
1544 XIf you start typing text, it will \fInot\fR be inserted,
1545 Xit will be treated as part of a command.
1546 XTo insert text, you must first give an "insert text
" command.
1547 XThis will take some getting used to.
1548 X(An alternative exists.
1549 XLookup the "inputmode
" option.)
1551 XThe \fIcolon mode\fR is quite different.
1552 X\*E displays a ":" character on the bottom line of the screen, as a prompt.
1553 XYou are then expected to type in a command line and hit the <Return> key.
1554 XThe set of commands recognized in the colon mode is different
1555 Xfrom visual mode's.
1558 sed '/^X/s///' > options.ms << '/'
1561 XOptions may be set or examined via the colon command "set".
1562 XThe values of options will affect the operation of later commands.
1564 XFor convenience, options have both a long descriptive name and a short name
1565 Xwhich is easy to type.
1566 XYou may use either name interchangably.
1567 XI like the short names, myself.
1569 XThere are three types of options: Boolean, string, and numeric.
1570 XBoolean options are made TRUE by giving the name of the option as an
1571 Xargument to the "set" command;
1572 Xthey are made FALSE by prefixing the name with "no
".
1573 XFor example, "set autoindent
" makes the autoindent option TRUE,
1574 Xand "set noautoindent
" makes it FALSE.
1575 X\*E also allows boolean options to be toggled by prefixing the name with "neg
".
1576 XSo, ":map g
:set neglist^M
" will cause the <g> key to alternately toggle the
1577 X"list
" option on and off.
1578 X(The "neg
" prefix is an extension; the real vi doesn't support it.)
1580 XTo change the value of a string or numeric option, pass the "set" command
1581 Xthe name of the option, followed by an "=" sign and the option's new value.
1582 XFor example, "set tabstop
=8" will give the tabstop option a value of 8.
1583 XFor string options, you may enclose the new value in quotes.
1587 X\fBNAMES TYPE DEFAULT MEANING\fP
1589 Xautoindent, ai Bool noai auto-indent during input
1590 Xautoprint, ap Bool ap in EX, print the current line
1591 Xautotab, at Bool at auto-indent allowed to use tabs?
1592 Xautowrite, aw Bool noaw auto-write when switching files
1593 Xbeautify, bf Bool nobf strip control chars from file?
1594 Xcharattr, ca Bool noca interpret \\fX sequences?
1595 Xcc, cc Str cc="cc
-c" name of the C compiler
1596 Xcolumns, co Num co=80 width of the screen
1597 Xdigraph, dig Bool nodig recognize digraphs?
1598 Xdirectory, dir Str dir="/usr
/tmp
" where tmp files are kept
1599 Xedcompatible, ed Bool noed remember ":s
//" options
1600 Xequalprg, ep Bool ep="fmt" program to run for = operator
1601 Xerrorbells, eb Bool eb ring bell on error
1602 Xexrc, exrc Bool noexrc read ".
/.exrc
" file?
1603 Xexrefresh, er Bool er write lines indiviually in EX
1604 Xflash, vbell Bool flash use visible alternative to bell
1605 Xflipcase, fc Str fc="" non-ASCII chars flipped by ~
1606 Xhideformat, hf Bool hf hide text formatter commands
1607 Xignorecase, ic Bool noic upper/lowercase match in search
1608 Xinputmode, im Bool noim start vi in insert mode?
1609 Xkeytime, kt Num kt=2 timeout for mapped key entry
1610 Xkeywordprg, kp Str kp="ref
" full pathname of shift-K prog
1611 Xlines, ln Num ln=25 number of lines on the screen
1612 Xlist, li Bool noli display lines in "list
" mode
1613 Xmagic, ma Bool ma use regular expression in search
1614 Xmake, mk Str mk="make" name of the "make" program
1615 Xmesg, ms Bool ms allow messages from other users?
1616 Xmodelines, ml Bool noml are modelines processed?
1617 Xmore, more Bool more pause between messages?
1618 Xnovice, nov Bool nonovice set options for ease of use
1619 Xparagraphs, para Str para="PPppIPLPQP
" names of "paragraph
" nroff cmd
1620 Xprompt, pr Bool pr show ':' prompt in \fIex\fR mode
1621 Xreadonly, ro Bool noro prevent overwriting of orig file
1622 Xremap, rem Bool remap allow key maps to call key maps
1623 Xreport, re Num re=5 report when 5 or more changes
1624 Xruler, ru Bool noru display line/column numbers
1625 Xscroll, sc Num sc=12 scroll amount for ^U and ^D
1626 Xsections, sect Str sect="NHSHSSSEse
" names of "section
" nroff cmd
1627 Xshell, sh Str sh="/bin
/sh
" full pathname of the shell
1628 Xshowmatch, sm Bool nosm show matching ()[]{}
1629 Xshowmode, smd Bool nosmd say when we're in input mode
1630 Xshiftwidth, sw Num sw=8 shift amount for < and >
1631 Xsidescroll, ss Num ss=8 amount of sideways scrolling
1632 Xsync, sy Bool nosy call sync() often
1633 Xtabstop, ts Num ts=8 width of tab characters
1634 Xtaglength, tl Num tl=0 significant chars in tag name
1635 Xterm, te Str te="$TERM" name of the termcap entry
1636 Xterse, tr Bool notr give shorter error messages
1637 Xtimeout, to Bool to distinguish <esc> from <arrow>?
1638 Xwarn, wa Bool wa warn for ! if file modified
1639 Xwindow, wi Num wi=24 lines to redraw after long move
1640 Xwrapmargin, wm Num wm=0 wrap long lines in input mode
1641 Xwrapscan, ws Bool ws at EOF, searches wrap to line 1
1642 Xwriteany, wr Bool nowr allow :w to clobber files
1646 X.IP "autoindent
, ai
"
1647 XDuring input mode, the autoindent option will cause each added line
1648 Xto begin with the same amount of leading whitespace as the line above it.
1649 XWithout autoindent, added lines are initially empty.
1650 X.IP "autoprint
, ap
"
1651 XThis option only affects EX mode.
1652 XIf the autoprint option on,
1653 Xand either the cursor has moved to a different line
1654 Xor the previous command modified the file,
1655 Xthen \*E will print the current line.
1657 XThis option affects the behaviour of the autoindent mode.
1658 XIf autoindent is turned off, then autotab has no effect.
1660 XWhen autotab is turned on, elvis will use a mixture of spaces and tabs
1661 Xto create the proper amount of indentation.
1662 XThis is the default.
1664 XWhen autotab is turned off, elvis will only use spaces for auto-indent.
1665 X\*E will still insert a real tab character when you hit the <Tab> key, though;
1666 Xthe autotab option only affects \fIautomatic\fR indentation.
1667 X.IP "autowrite
, aw
"
1668 XWhen you're editing one file and decide to switch to another
1669 X\- via the :tag command, or :next command, perhaps \-
1670 Xif your current file has been modified,
1671 Xthen \*E will normally print an error message and refuse to switch.
1673 XHowever, if the autowrite option is on,
1674 Xthen \*E will write the modified version of the current file
1675 Xand successfully switch to the new file.
1677 XThis option causes all control characters to be deleted from the text file,
1678 Xat the time when you start editing it.
1679 XIf you're already editing a file when you turn on the beautify option,
1680 Xthen that file won't be affected.
1682 XThe :cc command runs the C compiler.
1683 XThis option should be set to the name of your compiler.
1685 XMany text formatting programs allow you to designate portions of
1686 Xyour text to be underlined, italicized, or boldface by embedding
1687 Xthe special strings \\fU, \\fI, and \\fB in your text.
1688 XThe special string \\fP marks the end of underlined or boldface text.
1690 X\*E normally treats those special strings just like any other text.
1692 XHowever, if the charattr option is on, then \*E will interpret
1693 Xthose special strings correctly,
1694 Xto display underlined or boldface text on the screen.
1695 X(This only works, of course, if your terminal can display
1696 Xunderlined and boldface, and if the TERMCAP entry says how to do it.)
1698 XThis option shows how wide your screen is.
1700 XThis option is used to enable/disable recognition of digraphs.
1701 XThe default value is nodigraph, which means that digraphs will not be
1703 X.IP "directory
, dir
"
1704 X\*E stores text in temporary files.
1705 XThis option allows you to control which directory those temporary files will
1707 XThe default is /usr/tmp.
1709 XThis option can only be set in a .exrc file;
1710 Xafter that, \*E will have already started making temporary files
1711 Xin some other directory, so it would be too late.
1712 X.IP "edcompatible
, ed
"
1713 XThis option affects the behaviour of the ":s
/regexp
/text
/options
" command.
1714 XIt is normally off (:se noed) which causes all of the substitution options
1715 Xto be off unless explicitly given.
1717 XHowever, with edcompatible on (:se ed), the substitution command remembers
1718 Xwhich options you used last time.
1719 XThose same options will continue to be used until you change them.
1720 XIn edcompatible mode, when you explicitly give the name of a
1721 Xsubstitution option, you will toggle the state of that option.
1723 XThis all seems very strange to me, but its implementation was almost free
1724 Xwhen I added the ":&" command to repeat the previous substitution,
1727 XThis holds the name & arguments of the external filter program
1728 Xused the the visual = operator.
1729 XThe defualt value is "fmt",
1730 Xso the = operator will adjust line breaks in text.
1731 X.IP "errorbells
, eb
"
1732 X\*E normally rings a bell when you do something wrong.
1733 XThis option lets you disable the bell.
1735 XThis option specifies whether a .exrc file in the current directory
1736 Xshould be executed.
1737 XBy default, this option is off (":set noexrc
") which prevents elvis from
1738 Xexecuting .exrc in the current directory.
1739 XIf the .exrc file in your home directory turns this option on (":set exrc
")
1740 Xthen the \*E will attempt to execute the .exrc file in the current directory.
1742 XThis option exist mainly for security reasons.
1743 XA mean-spirited person could do something like
1745 X echo >/tmp/.exrc '!rm -rf $HOME'
1747 Xand then anybody who attempted to edit or view a file in the /tmp directory
1748 Xwould lose most of their files.
1749 XWith the exrc option turned off, this couldn't happen to you.
1750 X.IP "exrefresh
, er
"
1751 XThe EX mode of \*E writes many lines to the screen.
1752 XYou can make \*E either write each line to the screen separately,
1753 Xor save up many lines and write them all at once.
1755 XThe exrefresh option is normally on, so each line is written to the
1758 XYou may wish to turn the exrefresh option off (:se noer) if the
1759 X"write" system call is costly on your machine, or if you're using a
1760 Xwindowing environment.
1761 X(Windowing environments scroll text a lot faster when you write
1762 Xmany lines at once.)
1764 XThis option has no effect in visual command mode or input mode.
1766 XIf your termcap entry describes a visible alternative to ringing
1767 Xyour terminal's bell, then this option will say whether the visible
1768 Xversion gets used or not.
1769 XNormally it will be.
1771 XIf your termcap does NOT include a visible bell capability,
1772 Xthen the flash option will be off, and you can't turn it on.
1774 XThe flipcase option allows you to control how the non-ASCII characters are
1775 Xaltered by the "~
" command.
1777 XThe string is divided into pairs of characters.
1778 XWhen "~
" is applied to a non-ASCII character,
1779 X\*E looks up the character in the flipcase string to see which pair it's in,
1780 Xand replaces it by the other character of the pair.
1781 X.IP "hideformat
, hf
"
1782 XMany text formatters require you to embed format commands in your text,
1783 Xon lines that start with a ".
" character.
1784 X\*E normally displays these lines like any other text,
1785 Xbut if the hideformat option is on,
1786 Xthen format lines are displayed as blank lines.
1787 X.IP "ignorecase
, ic
"
1788 XNormally, when \*E searches for text, it treats uppercase letters
1789 Xas being different for lowercase letters.
1791 XWhen the ignorecase option is on, uppercase and lowercase are treated as equal.
1792 X.IP "inputmode
, im
"
1793 XThis option allows you to have \*E start up in insert mode.
1794 XYou can still exit insert mode at any time by hitting the ESC key, as usual.
1795 XUsually, this option would be set in your ".exrc
" file.
1797 XThe arrow keys of most terminals send a multi-character sequence.
1798 XIt takes a measurable amount of time for these sequences to be transmitted.
1799 XThe keytime option allows you to control the maximum amount of time
1800 Xto allow for an arrow key (or other mapped key) to be received in full.
1802 XOn most systems, the setting is the number of tenths of a second to allow
1803 Xbetween characters.
1804 XOn some other systems, the setting is in whole seconds.
1806 XTry to avoid setting keytime=1.
1807 XMost systems just count clock beats, so if you tried to read a character
1808 Xshortly before a clock beat, you could allow almost no time at all for
1809 Xreading the characters.
1810 XFor higher keytime settings, the difference is less critical.
1812 XIf your system's response time is poor, you might want to increase the keytime.
1813 XIn particular, I've found that when keystrokes must be sent through a network
1814 X(via X windows, rlogin, or telnet, for example) the keytime should be set to
1818 Xyou can set keytime to 0 to disable this time limit stuff altogether.
1819 XThe big problem here is:
1820 XIf your arrow keys' sequences start with an ESC,
1821 Xthen every time you hit your ESC key \*E will wait... and wait...
1822 Xto see if maybe that ESC was part of an arrow key's sequence.
1824 XNOTE: this option is a generalization of the timeout option of the real vi.
1825 X.IP "keywordprg
, kp
"
1826 X\*E has a special keyword lookup feature.
1827 XYou move the cursor onto a word, and hit shift-K,
1828 Xand \*E uses another program to look up the word
1829 Xand display information about it.
1831 XThis option says which program gets run.
1833 XThe default value of this option is "ref
",
1834 Xwhich is a program that looks up the definition of a function in C.
1835 XIt looks up the function name in a file called "refs
" which is created by ctags.
1837 XYou can subtitute other programs, such as an English dictionary program
1838 Xor the online manual.
1839 X\*E runs the program, using the keyword as its only argument.
1840 XThe program should write information to stdout.
1841 XThe program's exit status should be 0, unless you want \*E to print
1844 XThis option says how many lines you screen has.
1846 XIn nolist mode (the default), \*E displays text in a "normal" manner
1847 X-- with tabs expanded to an appropriate number of spaces, etc.
1849 XHowever, sometimes it is useful to have tab characters displayed differently.
1850 XIn list mode, tabs are displayed as "^I",
1851 Xand a "$" is displayed at the end of each line.
1853 XThe search mechanism in \*E can accept "regular expressions"
1854 X-- strings in which certain characters have special meaning.
1856 XThe magic option is normally on, which causes these characters to be treated
1859 XIf you turn the magic option off (:se noma),
1860 Xthen all characters except ^ and $ are treated literally.
1861 X^ and $ retain their special meanings regardless of the setting of magic.
1863 XThe :make command runs your "make" program.
1864 XThis option defines the name of your "make" program.
1866 XWith the real vi, running under real UNIX,
1867 X":set nomesg" would prevent other users from sending you messages.
1868 X\*E ignores it, though.
1869 X.IP "modelines, ml"
1870 X\*E supports modelines.
1871 XModelines are lines near the beginning or end of your text file which
1872 Xcontain "ex:yowza:",
1873 Xwhere "yowza" is any EX command.
1874 XA typical "yowza" would be something like "set ts=5 ca kp=spell wm=15".
1875 XOther text may also appear on a modeline,
1876 Xso you can place the "ex:yowza:" in a comment:
1879 X/* ex:set sw=4 ai: */
1882 XNormally these lines are ignored, for security reasons,
1883 Xbut if you have "set modelines" in your .exrc file
1884 Xthen "yowza" is executed.
1886 XThe command ":set novice" is equivelent to ":set nomagic report=1 showmode".
1887 X.IP "paragraphs, pa"
1888 XThe { and } commands move the cursor forward or backward in increments
1890 XParagraphs may be separated by blank lines, or by a "dot" command of
1892 XDifferent text formatters use different "dot" commands.
1893 XThis option allows you to configure \*E to work with your text formatter.
1895 XIt is assumed that your formatter uses commands that start with a
1896 X"." character at the front of a line,
1897 Xand then have a one- or two-character command name.
1899 XThe value of the paragraphs option is a string in which each pair
1900 Xof characters is one possible form of your text formatter's paragraph
1903 XWhen \*E must display a sequence of messages at the bottom line of the screen
1904 Xin visual mode, it normally pauses after all but the last one, so you have
1905 Xtime to read them all.
1907 XIf you turn off the "more" option, then \*E will not pause.
1908 XThis means you can only read the last message, but it is usually the most
1909 Ximportant one anyway.
1911 XIf you ":set noprompt", then \*E will no longer emit a ':' when it
1912 Xexpects you to type in an \fIex\fR command.
1913 XThis is slightly useful if you're using an astonishingly slow UNIX machine,
1914 Xbut the rest of us can just ignore this one.
1916 XNormally, \*E will let you write back any file to which you have
1918 XIf you don't have write permission, then you can only write the changed
1919 Xversion of the file to a \fIdifferent\fP file.
1921 XIf you set the readonly option,
1922 Xthen \*E will pretend you don't have write permission to \fIany\fP file you edit.
1923 XIt is useful when you really only mean to use \*E to look at a file,
1925 XThis way you can't change it accidentally.
1927 XThis option is normally off, unless you use the "view" alias of \*E.
1928 X"View" is like "vi" except that the readonly option is on.
1930 XThe ":map" command allows you to convert one key sequence into another.
1931 XThe remap option allows you to specify what should happen if portions of
1932 Xthat other sequence are also in the map table.
1933 XIf remap is on, then those portions will also be mapped, just as if they
1934 Xhad been typed on the keyboard.
1935 XIf remap is off, then the matching portions will not be mapped.
1937 XFor example, if you enter the commands ":map A B" and ":map B C",
1938 Xthen when remap is on, A will be converted to C.
1939 XBut when remap is off, A will be converted only to B.
1941 XCommands in \*E may affect many lines.
1942 XFor commands that affect a lot of lines, \*E will output a message saying
1943 Xwhat was done and how many lines were affected.
1944 XThis option allows you to define what "a lot of lines" means.
1945 XThe default is 5, so any command which affects 5 or more lines will cause
1946 Xa message to be shown.
1948 XThis option is normally off.
1949 XIf you turn it on, then \*E will constantly display the line/column numbers
1950 Xof the cursor, at the bottom of the screen.
1952 XThe ^U and ^D keys normally scroll backward or forward by half a screenful,
1953 Xbut this is adjustable.
1954 XThe value of this option says how many lines those keys should scroll by.
1955 XIf you invoke ^U or ^D with a count argument (for example, "33^D") then
1956 Xthis option's value is set to the count.
1958 XThe [[ and ]] commands move the cursor backward or forward in increments of
1960 XSections may be delimited by a { character in column 1
1961 X(which is useful for C source code)
1962 Xor by means of a text formatter's "dot" commands.
1964 XThis option allows you to configure \*E to work with your text formatter's
1965 X"section" command, in exectly the same way that the paragraphs option makes
1966 Xit work with the formatter's "paragraphs" command.
1968 XWhen \*E forks a shell
1969 X(perhaps for the :! or :shell commands)
1970 Xthis is the program that is uses as a shell.
1971 XThis is "/bin/sh" by default,
1972 Xunless you have set the SHELL (or COMSPEC, for MS-DOS) environment variable,
1973 Xit which case the default value is copied from the environment.
1974 X.IP "shiftwidth, sw"
1975 XThe < and > commands shift text left or right by some uniform number of columns.
1976 XThe shiftwidth option defines that "uniform number".
1978 X.IP "showmatch, sm"
1979 XWith showmatch set,
1980 Xin input mode every time you hit one of )}],
1981 X\*E will momentarily move the cursor to the matching ({[.
1982 X.IP "showmode, smd"
1983 XIn visual mode, it is easy to forget whether you're in the visual command mode
1984 Xor input/replace mode.
1985 XNormally, the showmode option is off, and you haven't a clue as to which mode
1987 XIf you turn the showmode option on, though, a little message will appear in the
1988 Xlower right-hand corner of your screen, telling you which mode you're in.
1989 X.IP "sidescroll, ss"
1990 XFor long lines, \*E scrolls sideways.
1991 X(This is different from the real vi,
1992 Xwhich wraps a single long line onto several rows of the screen.)
1994 XTo minimize the number of scrolls needed,
1995 X\*E moves the screen sideways by several characters at a time.
1996 XThe value of this option says how many characters' widths to scroll at a time.
1998 XGenerally, the faster your screen can be redrawn,
1999 Xthe lower the value you will want in this option.
2001 XIf the system crashes during an edit session, then most of your work
2002 Xcan be recovered from the temporary file that \*E uses to store
2004 XHowever, sometimes the OS will not copy changes to the
2005 Xhard disk immediately, so recovery might not be possible.
2006 XThe [no]sync option lets you control this.
2008 XIn nosync mode (which is the default, for UNIX), \*E lets the operating system
2009 Xcontrol when data is written to the disk.
2010 XThis is generally faster.
2012 XIn sync mode (which is the default for MS-DOS, AmigaDos, and Atari TOS),
2013 X\*E forces all changes out
2014 Xto disk every time you make a change.
2015 XThis is generally safer, but slower.
2016 XIt can also be a rather rude thing to do on a multi-user system.
2018 XTab characters are normally 8 characters wide,
2019 Xbut you can change their widths by means of this option.
2020 X.IP "taglength, tl"
2021 XThis option allows you to specify how many characters of a tag's name
2022 Xmust match when performing tag lookup.
2023 XAs a special case, ":set taglength=0" means that all characters of a tag's
2026 XNote: some configurations of \*E don't support this option.
2028 XThis read-only option shows the name of the termcap entry that
2029 X\*E is using for your terminal.
2031 XThe real vi uses this option to select longer vs. shorter error messages.
2032 X\*E has only one set of error messages, though, so this option has no effect.
2034 XThe command ":set notimeout" is equivelent to ":set keytime=0",
2035 Xand ":set timeout" is equivelent to ":set keytime=1".
2036 XThis affects the behaviour of the <Esc> key.
2037 XSee the discussion of the "keytime" option for more information.
2039 XIf you have modified a file but not yet written it back to disk, then
2040 X\*E will normally print a warning before executing a ":!cmd" command.
2041 XHowever, in nowarn mode, this warning is not given.
2043 X\*E also normally prints a message after a successful search that
2045 XThe [no]warn option can also disable this warning.
2047 XThis option controls how many lines are redrawn after a long move.
2049 XOn fast terminals, this is usually set to the number of rows that the
2050 Xterminal can display, minus one.
2051 XThis causes the entire screen to be filled with text around the cursor.
2053 XOn slow terminals, you may wish to reduce this value to about 7 or so.
2054 XThat way, if you're doing something like repeatedly hitting 'n' to search
2055 Xfor each occurrence of some string and trying to find a particular occurrence,
2056 Xthen you don't need to wait as long for \*E to redraw the screen after each
2058 X.IP "wrapmargin, wm"
2059 XNormally (with wrapmargin=0) \*E will let you type in extremely long
2060 Xlines, if you wish.
2062 XHowever, with warpmargin set to something other that 0 (wrapmargin=10
2063 Xis nice), \*E will automatically cause long lines to be "wrapped"
2064 Xon a word break for lines come too close to the right-hand margin.
2065 XFor example: On an 80-column screen, ":set wm=10" will cause lines to
2066 Xwrap when their length exceeds 70 columns.
2068 XNormally, when you search for something, \*E will find it no matter
2069 Xwhere it is in the file.
2070 X\*E starts at the cursor position, and searches forward.
2071 XIf \*E hits EOF without finding what you're looking for,
2072 Xthen it wraps around to continue searching from line 1.
2073 XIf you turn off the wrapscan option (:se nows),
2074 Xthen when \*E hits EOF during a search, it will stop and say so.
2076 XWith "writeany" turned off, elvis will prevent you from accidentally
2077 Xoverwriting a file.
2078 XFor example, if "foo" exists then ":w foo" will fail.
2079 XIf you turn on the "writeany" option, then ":w foo" will work.
2081 XRegardless of the setting of "writeany", though, ":w! foo" will work.
2082 XThe '!' forces the ":w" command to write the file unless the operating system
2085 echo x - question.ms
2086 sed '/^X/s///' > question.ms << '/'
2090 X.IP \fB\\n+(Qn) 0.3i
2095 X.Go 13 "QUESTIONS & ANSWERS"
2097 XHow can I make elvis run faster under DOS?
2099 XThere are several things you can do.
2100 XThe first thing to do is get a good screen driver such as NANSI.SYS.
2101 XThis can speed up screen redrawing by as much as a factor of eight!
2102 XThe DOS-specific part of section 12 tells you how to do this.
2104 XYou might also consider reducing the size of the blocks that elvis uses.
2105 XYou'll need to recompile \*E to do this.
2106 XThe default BLKSIZE is 1024 byte for the DOS version of \*E, which means
2107 Xthat for each keystroke that you insert, elvis must shift an average of
2109 XThat's a lot to ask from a little old 5MHz 8088.
2110 XA BLKSIZE of 512 bytes might be more appropriate.
2112 XIf you're \fIreally\fR desperate for more speed, you might want to make
2113 X\*E store its temporary files on a RAM disk.
2114 XHowever, this limits the size of the file you can edit, and it eliminates any
2115 Xchance you may have had to recover your work after a power failure
2116 Xor system crash, but it might be worth it; you decide.
2117 XTo do this, add ":set dir=R:\\" (or whatever your RAM disk's name is)
2118 Xto the \fIelvis.rc\fP file.
2120 XNext, consider turning off the "sync" option.
2121 XWhen the sync option is turned on, \*E will close the temporary file
2122 Xand reopen it after every change, in order to force DOS to update
2123 Xthe file's directory entry.
2124 XIf you put ":set nosync" into the \fIelvis.rc\fP file, then elvis will
2125 Xonly close the file when you start editing a different text file, or
2126 Xwhen you're exiting \*E.
2127 XConsequently, there is no chance that you'll be able to recover your
2128 Xchanges after a power failure... so if you're going to this, then you
2129 Xmight as well store the temp files on the RAM disk, too.
2131 XWhere's the <Esc> key on a DEC keyboard?
2133 XI don't know. Maybe the <F11> key?
2134 XYou could always use ":map!" to make some other key act like the <Esc> key.
2135 XIf all else fails, use <Control><[>.
2137 XIs there a way to show which keys do what?
2139 XYes. The command ":map" will show what each key does in command mode,
2140 Xand ":map!" (with an exclamation mark) shows what each key does in
2143 XThe table is divided into three columns: the key's label, the characters
2144 Xthat it sends, and the characters that \*E pretends you typed.
2146 XHow can I make \*E display long lines like the real vi?
2149 XThe next version of \*E shouldsupport this, though.
2151 XI can't recover my text [under MS-DOS or Atari TOS].
2152 XAccording to the directory listing, the temporary file is 0 bytes long.
2155 XMS-DOS and TOS only update a file's directory entry when the file is closed.
2156 XIf the system crashes while the file is still open, then the file's length
2157 Xis stored as 0 bytes.
2158 XThe ":set sync" option is supposed to prevent this;
2159 Xyou probably turned it off in the interest of speed, right?
2161 XUnder MS-DOS [I don't know about TOS], you should delete the empty
2162 Xtemporary file, and then run CHKDSK/F.
2163 XThis \fImight\fP find the data that belonged in the empty file,
2164 Xand place it in a new file with a name like "000001.CHK" -- something like that.
2165 XYou can then try to extract the text from that temporary file by giving the
2166 Xcommand "elvprsv -R 000001.chk >goodnews.txt".
2167 XIf you're lucky, then your text might be in GOODNEWS.TXT.
2169 XWhat is the most current version of \*E?
2171 XEach version of \*E that is released to the public has a version number
2172 Xof the form "number point number".
2173 XAs I write this, the most current version of elvis is 1.5.
2175 XThe intermediate steps between one release and the next are labeled with
2176 Xthe \fInext\fP version number, with a letter appended.
2177 XFor example, after 1.4 was released, I started working on 1.5a.
2178 XI am currently working on 2.0a.
2179 XWhen \*E reaches a stable state, I'll call it 2.0 and release it.
2181 XSometimes a beta-test version of elvis will be available via anonymous FTP
2182 Xfrom m2xenix.psg.com, in the directory "pub/elvis/beta".
2184 XI only got executables, but now I want the source code.
2185 XWhere can I get it?
2187 XIf you have access to the Internet, then you should be able to fetch it
2188 Xfrom one of the public archives such as \fBplains.nodak.edu\fP.
2189 XIt is accessible via anonymous FTP, or via an email server named
2190 X"archive-server@plains.nodak.edu".
2191 XElvis is located in the directory "/pub/Minix/all.contrib".
2193 XI will also offer it to the C Users' Group.
2194 XThey sell C source code for us$8 per diskette
2195 X(or slightly more outside North America).
2196 XTheir phone number is (913) 841-1631,
2197 Xand their address is:
2201 XLawrence KS 66046-0127
2204 XIs this shareware, or public domain, or what?
2206 XIt is not public domain; it is copyrighted by me, Steve Kirkendall.
2207 XHowever, this particular version is freely redistributable, in either
2208 Xsource form or executable form.
2209 X(I would prefer that you give copies away for free, complete with the
2210 Xfull source code... but I'm not going to force you.)
2212 XIt is not shareware; you aren't expected to send me anything.
2213 XYou can use it without guilt.
2215 XIt is not "copylefted."
2216 XI hold a copyright, but currently I have not added any of the usual restrictions
2217 Xthat you would find on copylefted software.
2218 XIf people start doing really obnoxious things to \*E, then I will start
2219 Xadding restrictions to subsequent versions, but earlier versions won't
2221 X(So far, everybody has been pretty good about this so no restrictions
2222 Xhave been necessary.)
2224 XCan I reuse parts of your source code?
2226 XYes. Please be careful, though, to make sure that the code really is mine.
2227 XSome of the code was contributed by other people, and I don't have the
2228 Xauthority to give you permission to use it.
2229 XThe author's name can be found near the top of each source file.
2230 XIf it says "Steve Kirkendall" then you may use it;
2231 Xotherwise, you'd better contact the author first.
2233 XPlease don't remove my name from the source code.
2234 XIf you modify the source, please make a note of that fact in a comment
2235 Xnear the top of the source code.
2236 XAnd, finally, please mention my name in your documentation.
2238 XCan \*E work with non-ASCII files?
2240 X\*E can't edit binary files because it can't handle the NUL character,
2241 Xand because of line-length limitations.
2242 XHowever, it is 8-bit clean so you should be able to edit any European
2243 Xextended ASCII file without any surprises.
2245 X\*E has also been modified to work with 16-bit character sets.
2246 XYongguang Zhang (ygz@cs.purdue.edu) has created a Chinese version of \*E
2247 Xthat uses 16-bit characters and runs under cxterm (Chinese X-term)
2248 Xon X-windows systems.
2249 XJunichiro Itoh (itojun@foretune.co.jp) has modified \*E to edit Japanese
2253 sed '/^X/s///' > regexp.ms << '/'
2254 X.Go 4 "REGULAR EXPRESSIONS"
2257 X\*E uses regular expressions for searching and substututions.
2258 XA regular expression is a text string in which some characters have
2260 XThis is much more powerful than simple text matching.
2264 X\*E' regexp package treats the following one- or two-character
2265 Xstrings (called meta-characters) in special ways:
2266 X.IP "\\\\\\\\(\fIsubexpression\fP\\\\\\\\)" 0.8i
2267 XThe \\( and \\) metacharacters are used to delimit subexpressions.
2268 XWhen the regular expression matches a particular chunk of text,
2269 X\*E will remember which portion of that chunk matched the \fIsubexpression\fP.
2270 XThe :s/regexp/newtext/ command makes use of this feature.
2272 XThe ^ metacharacter matches the beginning of a line.
2273 XIf, for example, you wanted to find "foo" at the beginning of a line,
2274 Xyou would use a regular expression such as /^foo/.
2275 XNote that ^ is only a metacharacter if it occurs
2276 Xat the beginning of a regular expression;
2277 Xanyplace else, it is treated as a normal character.
2279 XThe $ metacharacter matches the end of a line.
2280 XIt is only a metacharacter when it occurs at the end of a regular expression;
2281 Xelsewhere, it is treated as a normal character.
2282 XFor example, the regular expression /$$/ will search for a dollar sign at
2284 X.IP "\\\\\\\\<" 0.8i
2285 XThe \\< metacharacter matches a zero-length string at the beginning of
2287 XA word is considered to be a string of 1 or more letters and digits.
2288 XA word can begin at the beginning of a line
2289 Xor after 1 or more non-alphanumeric characters.
2290 X.IP "\\\\\\\\>" 0.8i
2291 XThe \\> metacharacter matches a zero-length string at the end of a word.
2292 XA word can end at the end of the line
2293 Xor before 1 or more non-alphanumeric characters.
2294 XFor example, /\\<end\\>/ would find any instance of the word "end",
2295 Xbut would ignore any instances of e-n-d inside another word
2296 Xsuch as "calendar".
2298 XThe . metacharacter matches any single character.
2299 X.IP "[\fIcharacter-list\fP]" 0.8i
2300 XThis matches any single character from the \fIcharacter-list\fP.
2301 XInside the \fIcharacter-list\fP, you can denote a span of characters
2302 Xby writing only the first and last characters, with a hyphen between
2304 XIf the \fIcharacter-list\fP is preceded by a ^ character, then the
2305 Xlist is inverted -- it will match character that \fIisn't\fP mentioned
2307 XFor example, /[a-zA-Z]/ matches any letter, and /[^ ]/ matches anything
2308 Xother than a blank.
2309 X.IP "\\\\\\\\{\fIn\fP\\\\\\\\}" 0.8i
2310 XThis is a closure operator,
2311 Xwhich means that it can only be placed after something that matches a
2313 XIt controls the number of times that the single-character expression
2314 Xshould be repeated.
2316 XThe \\{\fIn\fP\\} operator, in particular, means that the preceding
2317 Xexpression should be repeated exactly \fIn\fP times.
2318 XFor example, /^-\\{80\\}$/ matches a line of eighty hyphens, and
2319 X/\\<[a-zA-Z]\\{4\\}\\>/ matches any four-letter word.
2320 X.IP "\\\\\\\\{\fIn\fP,\fIm\fP\\\\\\\\}" 0.8i
2321 XThis is a closure operator which means that the preceding single-character
2322 Xexpression should be repeated between \fIn\fP and \fIm\fP times, inclusive.
2323 XIf the \fIm\fP is omitted (but the comma is present) then \fIm\fP is
2324 Xtaken to be inifinity.
2325 XFor example, /"[^"]\\{3,5\\}"/ matches any pair of quotes which contains
2326 Xthree, four, or five non-quote characters.
2328 XThe * metacharacter is a closure operator which means that the preceding
2329 Xsingle-character expression can be repeated zero or more times.
2330 XIt is equivelent to \\{0,\\}.
2331 XFor example, /.*/ matches a whole line.
2332 X.IP "\\\\\\\\+" 0.8i
2333 XThe \\+ metacharacter is a closure operator which means that the preceding
2334 Xsingle-character expression can be repeated one or more times.
2335 XIt is equivelent to \\{1,\\}.
2336 XFor example, /.\\+/ matches a whole line, but only if the line contains
2337 Xat least one character.
2338 XIt doesn't match empty lines.
2339 X.IP "\\\\\\\\?" 0.8i
2340 XThe \\? metacharacter is a closure operator which indicates that the
2341 Xpreceding single-character expression is optional -- that is, that it
2342 Xcan occur 0 or 1 times.
2343 XIt is equivelent to \\{0,1\\}.
2344 XFor example, /no[ -]\\?one/ matches "no one", "no-one", or "noone".
2346 XAnything else is treated as a normal character which must exactly match
2347 Xa character from the scanned text.
2348 XThe special strings may all be preceded by a backslash to
2349 Xforce them to be treated normally.
2353 XThe :s command has at least two arguments: a regular expression,
2354 Xand a substitution string.
2355 XThe text that matched the regular expression is replaced by text
2356 Xwhich is derived from the substitution string.
2358 X.ne 15 \" so we don't mess up the table
2360 XMost characters in the substitution string are copied into the
2361 Xtext literally but a few have special meaning:
2364 X & Insert a copy of the original text
2365 X ~ Insert a copy of the previous replacement text
2366 X \\1 Insert a copy of that portion of the original text which
2367 X matched the first set of \\( \\) parentheses
2368 X \\2-\\9 Do the same for the second (etc.) pair of \\( \\)
2369 X \\U Convert all chars of any later & or \\# to uppercase
2370 X \\L Convert all chars of any later & or \\# to lowercase
2371 X \\E End the effect of \\U or \\L
2372 X \\u Convert the first char of the next & or \\# to uppercase
2373 X \\l Convert the first char of the next & or \\# to lowercase
2377 XThese may be preceded by a backslash to force them to be treated normally.
2378 XIf "nomagic" mode is in effect,
2379 Xthen & and ~ will be treated normally,
2380 Xand you must write them as \\& and \\~ for them to have special meaning.
2384 X\*E has two options which affect the way regular expressions are used.
2385 XThese options may be examined or set via the :set command.
2387 XThe first option is called "[no]magic".
2388 XThis is a boolean option, and it is "magic" (TRUE) by default.
2389 XWhile in magic mode, all of the meta-characters behave as described above.
2390 XIn nomagic mode, only ^ and $ retain their special meaning.
2392 XThe second option is called "[no]ignorecase".
2393 XThis is a boolean option, and it is "noignorecase" (FALSE) by default.
2394 XWhile in ignorecase mode, the searching mechanism will not distinguish between
2395 Xan uppercase letter and its lowercase form.
2396 XIn noignorecase mode, uppercase and lowercase are treated as being different.
2398 XAlso, the "[no]wrapscan" option affects searches.
2402 XThis example changes every occurence of "utilize" to "use":
2407 XThis example deletes all whitespace that occurs at the end of a line anywhere
2409 X(The brackets contain a single space and a single tab.):
2414 XThis example converts the current line to uppercase:
2419 XThis example underlines each letter in the current line,
2420 Xby changing it into an "underscore backspace letter" sequence.
2421 X(The ^H is entered as "control-V backspace".):
2426 XThis example locates the last colon in a line,
2427 Xand swaps the text before the colon with the text after the colon.
2428 XThe first \\( \\) pair is used to delimit the stuff before the colon,
2429 Xand the second pair delimit the stuff after.
2430 XIn the substitution text, \\1 and \\2 are given in reverse order
2431 Xto perform the swap:
2434 X:s/\\(.*\\):\\(.*\\)/\\2:\\1/
2437 sed '/^X/s///' > termcap.ms << '/'
2440 X\*E uses fairly standard termcap fields for most things.
2441 XI invented the cursor shape names
2442 Xbut other than that there should be few surprises.
2444 XRequired numeric fields
2447 X:co#: number of columns on the screen (chars per line)
2448 X:li#: number of lines on the screen
2451 XRequired string fields
2454 X:ce=: clear to end-of-line
2455 X:cl=: home the cursor & clear the screen
2456 X:cm=: move the cursor to a given row/column
2457 X:up=: move the cursor up one line
2463 X:am: auto margins - wrap when char is written in last column?
2464 X:xn: brain-damaged auto margins - newline ignored after wrap
2465 X:pt: physical tabs?
2468 XOptional string fields
2471 X:al=: insert a blank row on the screen
2472 X:dl=: delete a row from the screen
2473 X:cd=: clear to end of display
2474 X:ei=: end insert mode
2475 X:ic=: insert a blank character
2476 X:im=: start insert mode
2477 X:dc=: delete a character
2478 X:sr=: scroll reverse (insert row at top of screen)
2480 X:ti=: terminal initialization string, to start full-screen mode
2481 X:te=: terminal termination, to end full-screen mode
2482 X:ks=: enables the cursor keypad
2483 X:ke=: disables the cursor keypad
2486 XOptional strings received from the keyboard
2489 X:kd=: sequence sent by the <down arrow> key
2490 X:kl=: sequence sent by the <left arrow> key
2491 X:kr=: sequence sent by the <right arrow> key
2492 X:ku=: sequence sent by the <up arrow> key
2493 X:kP=: sequence sent by the <PgUp> key
2494 X:kN=: sequence sent by the <PgDn> key
2495 X:kh=: sequence sent by the <Home> key
2496 X:kH=: sequence sent by the <End> key
2497 X:kI=: sequence sent by the <Insert> key
2500 XOriginally, termcap didn't have any names for the <PgUp>, <PgDn>, <Home>,
2502 XAlthough the capability names shown in the table above are the most common,
2503 Xthey are \fInot\fR universal.
2504 XSCO Xenix uses :PU=:PD=:HM=:EN=: for those keys.
2505 XAlso, if the four arrow keys happen to be part of a 3x3 keypad,
2506 Xthen the five non-arrow keys may be named :K1=: through :K5=:,
2507 Xso an IBM PC keyboard may be described using those names instead.
2508 X\*E can find any of these names.
2510 XOptional strings sent by function keys
2513 X:k1=:...:k9=:k0=: codes sent by <F1> through <F10> keys
2514 X:s1=:...:s9=:s0=: codes sent by <Shift F1> ... <Shift F10>
2515 X:c1=:...:c9=:c0=: codes sent by <Ctrl F1> ... <Ctrl F10>
2516 X:a1=:...:a9=:a0=: codes sent by <Alt F1> ... <Alt F10>
2519 XNote that :k0=: is used to describe the <F10> key.
2520 XSome termcap documents recommend :ka=: or even :k;=: for describing
2521 Xthe <F10> key, but \*E doesn't support that.
2523 XAlso, the :s1=:..., :c1=:..., and :a1=:... codes are very non-standard.
2524 XThe terminfo library doesn't support them.
2526 XOptional fields that describe character attributes
2529 X:so=:se=: start/end standout mode (We don't care about :sg#:)
2530 X:us=:ue=: start/end underlined mode
2531 X:md=:me=: start/end boldface mode
2532 X:as=:ae=: start/end alternate character set (italics)
2533 X:ug#: visible gap left by :us=:ue=:md=:me=:as=:ae=:
2536 XOptional fields that affect the cursor's shape
2538 XThe :cQ=: string is used by \*E immediately before exiting to undo
2539 Xthe effects of the other cursor shape strings.
2540 XIf :cQ=: is not given, then all other cursor shape strings are ignored.
2542 X:cQ=: normal cursor
2543 X:cX=: cursor used for reading EX command
2544 X:cV=: cursor used for reading VI commands
2545 X:cI=: cursor used during VI input mode
2546 X:cR=: cursor used during VI replace mode
2549 XIf the capabilities above aren't given, then \*E will try to use the
2550 Xfollowing values instead.
2552 X:ve=: normal cursor, used as :cQ=:cX=:cI=:cR=:
2553 X:vs=: gaudy cursor, used as :cV=:
2558 XHere's the termcap entry I use on my Minix-ST system.
2559 XSome of the fields in it have nothing to do with \*E.
2560 XSome can only work on my system;
2561 XI have modified my kernel's screen driver.
2565 Xmx|minix|minixst|ansi:\\
2566 X :is=\\E[0~:co#80:li#25:bs:pt:\\
2567 X :cm=\\E[%i%d;%dH:up=\\E[A:do=^J:nd=\\E[C:sr=\\EM:\\
2568 X :cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:\\
2569 X :al=\\E[L:dl=\\E[M:ic=\\E[@:dc=\\E[P:im=:ei=:\\
2570 X :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:\\
2571 X :md=\\E[1m:me=\\E[m:as=\\E[1;3m:ae=\\E[m:\\
2572 X :ku=\\E[A:kd=\\E[B:kr=\\E[C:kl=\\E[D:\\
2573 X :k1=\\E[1~:k2=\\E[2~:k3=\\E[3~:k4=\\E[4~:k5=\\E[5~:\\
2574 X :k6=\\E[6~:k7=\\E[17~:k8=\\E[18~:k9=\\E[19~:k0=\\E[20~:\\
2575 X :kU=\\E[36~:kQ=\\E[32~:kH=\\E[28~:\\
2576 X :GV=3:GH=D:G1=?:G2=Z:G3=@:G4=Y:GC=E:GL=4:GR=C:GU=A:GD=B:\\
2577 X :cQ=\\E[k:cX=\\E[2;0k:cV=\\E[16;0k:cI=\\E[k:cR=\\E[16;20k:
2581 sed '/^X/s///' > title.ms << '/'
2595 X####### ###### ## # ####
2603 X- a clone of vi/ex -
2609 X14407 SW Teal Blvd., Apt C
2611 XBeaverton, OR 97005
2613 Xkirkenda@cs.pdx.edu
2618 sed '/^X/s///' > ver.ms << '/'
2619 X.ds V 1.5j-betatest
2620 X.if t .ds E E\s-2LVIS\s+2
2623 X.\" usage: .Go <section#> <title>
2625 X.ds LH "\\$1-\\\\n%
2626 X.ds RH "\\$1-\\\\n%
2630 X.\"if !\\n%=1 .bp 1
2634 echo x - versions.ms
2635 sed '/^X/s///' > versions.ms << '/'
2638 X\*E currently works under BSD UNIX, AT&T System-V UNIX, SCO XENIX,
2639 XMinix, Coherent, MS-DOS, Atari TOS, OS9/68k, VAX/VMS, and AmigaDos.
2640 XThis section of the manual provides special information that applies to each
2641 Xparticular version of \*E.
2643 XFor all versions except MS-DOS,
2644 Xthe file "Makefile.mix" should be copied to "Makefile",
2645 Xand then edited to select the correct set of options for your system.
2646 XThere is more information about this embedded in the file itself.
2650 XTemporary files are stored in /tmp.
2652 XYou should modify /etc/rc so that
2653 Xthe temp files are preserved when the system is rebooted.
2654 XFind a line in /etc/rc which reads
2659 Xor something like that, and append the following line after it:
2664 XIf you do not have permission to modify /etc/rc, don't fret.
2665 XThe above modification is only needed to allow you to recover your changes
2666 Xafter a system crash.
2667 XYou can still run \*E without that modification,
2668 Xand you can still recover your changes when \*E crashes
2669 Xor when your dialup modem looses the carrier signal, or something like that.
2670 XOnly a system crash or power failure could hurt you.
2672 XBoth \*E and the real Vi
2673 Xread initialization commands from a file called ".exrc",
2674 Xbut the commands in that file might work on one but not the other.
2675 XFor example, "set keywordprg=man" will work for \*E,
2676 Xbut Vi will complain because it doesn't have a "keywordprg" option.
2677 XIf the warning messages annoy you, then you can edit the config.h file
2678 Xto change the name of the initialization file ".exrc" to something else,
2679 Xsuch as ".elvisrc".
2681 XIf you use X windows, you may wish to add "-DCS_LATIN1" to CFLAGS.
2682 XThis will cause the digraph table and the flipcase option to have default
2683 Xvalues that are appropriate for the LATIN-1 character set.
2684 XThat's the standard character set for X.
2686 XThe default keyboard macro time-out value is larger for BSD than it is for
2687 Xsome other systems, because I've had trouble running \*E via rlogin or Xterm.
2688 XI guess it takes a while for those keystokes to squirt through the net.
2692 XMost SysV UNIX systems use terminfo instead of termcap,
2693 Xbut the terminfo library doesn't seem to have a standard name.
2694 XAs shipped, Elvis' Makefile.mix is configured with "LIBS=-lterm".
2695 XYou may need to change it to "LIBS=-ltermcap" or "LIBS=-lterminfo"
2696 Xor even "LIBS=-lcurses".
2698 XThe /etc/rc file should be modified as described for BSD systems, above.
2699 XThe only difference is that SysV systems tend to have directories for
2700 Xinitialization, instead of a single large /etc/rc file.
2701 XEditor recovery is usually done somewhere in the /etc/rc2.d directory.
2703 XThe potential trouble with ".exrc" described above for BSD UNIX applies
2704 Xto System-V UNIX as well.
2706 X\*E uses control-C as the interrupt key, not Delete.
2710 XFor Xenix-386, you can use the generic System-V settings.
2711 XYou may wish to add "-DCS_IBMPC" to CFLAGS, to have the digraph table and
2712 Xflipcase option start up in a mode that is appropriate for the console.
2714 XThere is a separate group of settings for use with Xenix-286.
2715 XIt already has "-DCS_IBMPC" in CFLAGS.
2717 XBecause Xenix is so similar to System-V, everything I said earlier about
2718 XSystem-V applies to the Xenix version too, except that editor recovery
2719 Xprobably belongs in a directory called /etc/rc.d/8.
2723 XThere are separate settings in Makefile.mix for Minix-PC and Minix-68k.
2724 XThe differences between these two are that
2725 Xthe 68k version uses ".o" for the object file extension where
2726 Xthe PC version uses ".s", and
2727 Xthe PC version has some extra flags in CFLAGS to reduce the size of \*E.
2728 XThe PC version also uses tinytcap (instead of the full termcap) to make it smaller.
2730 XMinix-PC users should read the CFLAGS section of this manual very carefully.
2731 XYou have some choices to make...
2733 XThe temporary files are stored in /usr/tmp.
2734 XThe /usr/tmp directory must exist before you run \*E,
2735 Xand it must be readable/writable by everybody.
2736 XWe use /usr/tmp instead of /tmp because
2737 Xafter a system crash or power failure,
2738 Xyou can recover the altered version of a file from the temporary file
2740 XIf it was stored in /tmp, though, then it would be lost because /tmp is
2741 Xnormally located on the RAM disk.
2743 X\*E uses control-C as the interrupt key, not Delete.
2747 X\*E was ported to Coherent by Esa Ahola.
2749 X\*E is too large to run under Coherent unless you eliminate some
2750 Xfeatures via the CFLAGS setting.
2751 XThe recommended settings, in Makefile.mix, produce a working version
2752 Xof \*E which emulates Vi faithfully, but lacks most of the extensions.
2753 XYou should read the CFLAGS section of this manual carefully.
2755 XYou can probably reduce the size of \*E by using tinytcap.c instead of -lterm.
2756 XThis would allow you to keep most features of \*E,
2757 Xat the expense of terminal independence.
2758 X(Tinytcap.c has ANSI escape sequences hard-coded into it.)
2759 XTo use tinytcap, just add "tinytcap.o" to the "EXTRA=" line in the Makefile,
2760 Xand remove "-lterm" from the "LIBS=" line.
2762 XThe temporary files are stored in /tmp.
2763 XYou should modify your /etc/rc file as described for BSD earlier.
2767 X\*E was ported to MS-DOS by Guntram Blohm and Martin Patzel.
2768 XWillett Kempton added support for the DEC Rainbow.
2770 XIdeally, \*E should be compiled with Microsoft C 5.10 and the standard
2771 XMicrosoft Make utility,
2772 Xvia the command "make elvis.mak".
2773 XThis will compile \*E and all related utilities.
2775 XWith Microsoft C 6.00, you may have trouble compiling regexp.c.
2776 XIf so, try compiling it without optimization.
2778 XThe "Makefile.mix" file contains a set of suggested settings for compiling
2779 Xelvis with Turbo-C or Borland C.
2780 X(If you have Turbo-C, but not the Make utility,
2781 Xthen you can \fIalmost\fR use the "\*E.prj" file to compile \*E,
2782 Xbut you must explicitly force Turbo-C to compile it with the "medium" memory model.
2783 XMost of the related programs [ctags, ref, virec, refont, and wildcard] are
2784 Xonly one file long, so you should have no trouble compiling them.)
2785 XThe "alias.c" file is meant to be compiled once into an executable named
2787 XYou should then copy "ex.exe" to "vi.exe" and "view.exe".
2789 X\*E stores its temporary files in C:\\tmp.
2790 XIf this is not satisfactory, then you should edit the CFLAGS line of
2791 Xyour Makefile to change TMPDIR to something else before compiling.
2792 XYou can also control the name of the temp directory via an environment
2793 Xvariable named TMP or TEMP.
2794 XThe directory must exist before you can run \*E.
2796 XThe TERM environment variable determines how elvis will write to the screen.
2797 XIt can be set to any one of the following values:
2800 X pcbios Use BIOS calls on an IBM-PC clone.
2801 X rainbow Use DEC Rainbow interface.
2802 X ansi Use ANSI.SYS driver.
2803 X nansi User faster NANSI.SYS driver.
2806 XIf the TERM variable isn't set, then elvis will automatically select either
2807 Xthe "rainbow" interface (when run on a Rainbow) or "pcbios" (on an IBM clone).
2809 XYou may prefer to use NANSI.SYS for speed;
2810 Xor you may NEED to use ANSI.SYS for a non-clone, such as a lap-top.
2812 Xinstall one of these drivers by adding "driver = nansi.sys" (or whatever)
2813 Xto your CONFIG.SYS file,
2814 Xand then you should define TERM to be "nansi" (or whatever) by adding
2815 X"set TERM=nansi" to your AUTOEXEC.BAT file.
2816 XYou must then reboot for these changes to take effect.
2817 XAfter that, \*E will notice the "TERM" setting and use the driver.
2819 XSince ".exrc" is not a valid DOS filename,
2820 Xthe name of the initialization file has been changed to "elvis.rc".
2821 XElvis will look for an "elvis.rc" file first in your home directory,
2822 Xand then in the current directory.
2823 XNote that you must set an environment variable named "HOME" to the
2824 Xfull pathname of your home directory, for Elvis to check there;
2825 Xif "HOME" isn't set, then Elvis will only look in the current directory.
2826 XTo set "HOME", you would typically add the following line to your
2832 XAn extra program, called "wildcard", is needed for MS-DOS.
2833 XIt expands wildcard characters in file names.
2834 XIf \*E flashes a "Bad command or filename" message when it starts,
2835 Xthen you've probably lost the WILDCARD.EXE program somehow.
2837 X\*E can run under Windows, but only in full-screen mode.
2838 XAlso, Windows uses an environment variable called TEMP which interferes with
2839 Xelvis' usage of TEMP;
2840 Xto work around this, you can simply set an environment variable named
2841 XTMP (with no 'E') to the name of elvis' temporary directory.
2842 XWhen TEMP and TMP are both set, \*E uses TMP and ignored TEMP.
2846 X\*E was ported to Atari TOS by Guntram Blohm and Martin Patzel.
2847 XIt is very similar to the MS-DOS version.
2848 XIt has been tested with the Mark Williams C compiler and also GNU-C.
2850 XThe TERM environment variable is ignored;
2851 Xthe ST port always assumes that TERM=vt52.
2852 XThe SHELL (not COMSPEC!) variable should be set to
2853 Xthe name of a line-oriented shell.
2855 XA simple shell in included with \*E.
2856 XIts source is in "shell.c", and the name of the executable is "shell.ttp".
2857 XThe file "profile.sh" should contain a set of instructions to be executed
2858 Xwhen the shell first starts up.
2859 XAn example of this file is included, but you will almost certainly want to
2860 Xedit it right away to match your configuration.
2861 X(If you already have a command-line shell,
2862 Xthen you'll probably want to continue using it.
2863 XThe shell that comes with \*E is very limited.)
2865 XCurrently, character attributes cannot be displayed on the screen.
2867 X\*E runs under MiNT (a free multi-tasking extension to TOS)
2868 Xbut it can be a CPU hog because of the way that \*E reads from the
2869 Xkeyboard with timeout.
2870 XAlso, \*E doesn't use any of the special features of MiNT.
2871 XI have received a set of patches that optimize \*E for MiNT,
2872 Xbut they arrived too late to integrate into this release.
2876 X\*E was ported to OS9/68k by Peter Reinig.
2878 XThe Makefile is currently configured to install \*E and the related
2879 Xprograms in /dd/usr/cmds
2880 XIf this this is unacceptable, then you should change the BIN setting
2881 Xto some other directory.
2882 XSimilarly, it expects the source code to reside in /dd/usr/src/elvis;
2883 Xthe ODIR setting is used to control this.
2885 XTemporary files are stored in the /dd/tmp directory.
2886 XYour /dd/startup file may need to be modified
2887 Xto prevent it from deleting \*E' temporary files;
2888 Xmake /dd/startup run the \fIelvprsv\fR program before it wipes out /dd/tmp.
2890 XThe program in alias.c is linked repeatedly to produce the
2891 X"vi", "view", and "input" aliases for \*E.
2892 XSadly, the "ex" alias is impossible to implement under OS9
2893 Xbecause the shell has a built-in command by that name.
2896 Xyou must give `make' the "-b" option.
2897 XSpecifically, you need this for "make -b clean" and "make -b install".
2901 XJohn Campbell ported \*E to VAX/VMS.
2903 XA heavily laden VAX can take half an hour to compile elvis.
2907 XWhile running, elvis will create temporary files in SYS$SCRATCH.
2908 XEnter SHOW LOGICAL SYS$SCRATCH to see what actual directory you are using.
2909 XMany sites have SYS$SCRATCH equivalenced to SYS$LOGIN.
2910 XThe elvis temporary files look like the following on VMS while elvis is running:
2913 XELV_1123A.1;1 ELV_1123A.2;1 SO070202.;1
2915 XAlso, filtering commands (like !!dir and !}fmt) should work on VMS.
2916 XThis assumes, however, that you can create temporary mailboxes and that
2917 Xyour mailbox quota (a sysgen parameter) is at least 256 bytes for a
2918 Xsingle write to the mailbox.
2919 XThis is the default sysgen parameter,
2920 Xso there should be few people who experience filter problems.
2922 XAdditionally, an attempt was made to support the standard terminals on VMS:
2923 X"vt52", "vt100", "vt200", "vt300", "vt101", "vt102".
2924 XNon-standard terminals could be supported by setting your terminal type to
2925 XUNKNOWN (by entering SET TERM/UNKNOWN)
2926 Xand defining the logical name ELVIS_TERM.
2927 XWhatever ELVIS_TERM translates to, however, will have to be included in
2929 XNote that the upper/lowercase distinctions are significant,
2930 Xand that DCL will upshift characters that are not quoted strings, so
2931 Xenter DEFINE ELVIS_TERM "hp2621a".
2932 XAs distributed, it would probably not be a good idea to have more than the
2933 Xstandard terminals in tinytcap.c (else it wouldn't be tiny, would it?).
2934 XChanges here, of course, would require a recompilation to take effect.
2936 XIf you have a version of the "termcap" library and database on your system,
2937 Xthen you may wish to replace tinytcap with the real termcap.
2941 XMike Rieser and Dale Rahn ported \*E to AmigaDOS.
2943 XThe port was done using Manx Aztec C version 5.2b.
2944 X\*E uses about as much space as it can and still be small code and data.
2945 X\*E should also compile under DICE, though there may be a little trouble with
2946 Xsigned versus unsigned chars.
2948 XThe port has been done so the same binary will run under both versions of AmigaDOS.
2949 XUnder AmigaDOS 2.04, \*E supports all the documented features.
2950 XIt also uses an external program ref to do tag lookup.
2951 XSo, the accompanying programs: ref and ctags are recommended.
2952 XUnder AmigaDOS 1.2/1.3 \*E works, buts lacks the more advanced features.
2954 XFor the port to AmigaDOS 2.04, we tried to use as many Native AmigaDOS
2956 XThis should increase Elvis's chances at being compiled with other compilers.
2957 XDICE seems to have a different default char type.
2958 XYou may need to use the UCHAR() macro in tio.c.
2959 XTo test it, try the :map command; if it looks right, things are cool.
2961 XFor the port to AmigaDOS 1.3, we tried to make sure the program was at
2963 XMany features are missing, most notably running commands in subshells.
2964 XAlso, what we could get working, we used Aztec functions to support them,
2965 Xso this part is little more compiler dependent.
2967 XAztec is compatible with the SAS libcall #pragma.
2968 XI personally prefer using the includes that come from Commodore over the ones
2969 Xsupplied with Aztec, but for people with a straight Aztec installation,
2970 XI went with the default names for the Aztec pragmas.
2972 XOne include you'll need is <sys/types.h>.
2973 XIts a common include when porting software just make yourself one.
2974 XIts a two line file that saves a lot of hassle especially in the elvis source.
2975 XSo, make a directory where your includes are located called `sys'
2976 Xand in a file below that type:
2982 X#include <exec/types.h>
2984 XWhen setting environment variables (either local or global) for
2985 Xvariables that specify a directory, make sure the variable ends in `:'
2987 XThis saved from having to change much of the way elvis works.
2988 XThe default temporary directory (if TEMP and TMP aren't specified) is "T:".
2989 XThe default if HOME directory (if no HOME environment variable is set) is "S:".
2991 XTo avoid conlict with other uses, \*E uses elvis.rc instead of .exrc or
2992 Xwhere it looks for macros.
2996 XFor Sun workstations, use the BSD configuration.
2997 XEarlier versions of elvis didn't link correctly due to a quirk in Sun's
2998 Xversion of the "make" utility, but this version of elvis has a work-around
2999 Xfor that quirk so you should have no trouble at all.
3001 XFor Linux, use the SysV settings.
3002 XYou can probably just remove the "-lterm" from the "LIBS= -lterm" line,
3003 Xsince linux keeps the termcap functions in the standard C library.
3005 XFor other UNIXoid systems, I suggest you start with the Minix-68k settings
3006 Xand then grow from that.
3007 XMinix is a nice starting point because it is a clone of Version 7 UNIX,
3008 Xwhich was the last common ancestor of BSD UNIX and SysV UNIX.
3009 XAny Operating System which claims any UNIX compatibility what so ever
3010 Xwill therefore support V7/Minix code.
3011 XYou may need to fiddle with #include directives or something, though.
3012 XMinix-68k is a better starting point than Minix-PC because the PC compiler
3013 Xhas some severe quirks.
3016 sed '/^X/s///' > visual.ms << '/'
3017 X.Go 2 "VISUAL MODE COMMANDS"
3019 XMost visual mode commands are one keystroke long.
3020 XThe following table lists the operation performed by each keystroke,
3021 Xand also denotes any options or arguments that it accepts.
3022 XNotes at the end of the table describe the notation used in this table.
3024 XIn addition to the keys listed here, your keyboard's "arrow" keys
3025 Xwill be interpretted as the appropriate cursor movement commands.
3026 XThe same goes for <PgUp> and <PgDn>, if your keyboard has them.
3027 XThe <Insert> key will toggle between insert mode and replace mode.
3028 XThere is a colon mode command (":map", to be described later)
3029 Xwhich will allow you to define other keys, such as function keys.
3031 XA tip: visual command mode looks a lot like text input mode.
3032 XIf you forget which mode you're in, just hit the <Esc> key.
3033 XIf \*E beeps, then you're in visual command mode.
3034 XIf \*E does not beep, then you were in input mode,
3035 Xbut by hitting <Esc> you will have switched to visual command mode.
3036 XSo, one way or another, after <Esc> \*E will be ready for a command.
3039 X\s+2COMMAND DESCRIPTION\s-2
3040 X ^A Search for next occurence of word at cursor (MOVE)(EXT)
3041 X ^B Move toward the top of the file by 1 screenful
3042 X ^C --- (usually sends SIGINT, to interupt a command)
3043 Xcount ^D Scroll down <count> lines (default 1/2 screen)
3044 Xcount ^E Scroll up <count> lines
3045 X ^F Move toward the bottom of the file by 1 screenful
3046 X ^G Show file status, and the current line #
3047 Xcount ^H Move left, like h (MOVE)
3049 Xcount ^J Move down (MOVE)
3051 X ^L Redraw the screen
3052 Xcount ^M Move to the front of the next line (MOVE)
3053 Xcount ^N Move down (MOVE)
3055 Xcount ^P Move up (MOVE)
3056 X ^Q --- (typically XON, which restarts screen updates)
3057 X ^R Redraw the screen
3058 X ^S --- (typically XOFF, which stops screen updates)
3060 Xcount ^U Scroll up <count> lines (default 1/2 screen)
3063 Xcount ^X Move to a physical column number on the screen (MOVE) (EXT)
3064 Xcount ^Y Scroll down <count> lines
3065 X ^Z --- (sometimes sends SIGSUSP, to suspend execution)
3067 X ^\\ --- (usually sends SIGQUIT, which is ignored)
3068 X ^] If the cursor is on a tag name, go to that tag
3069 X ^^ Switch to the previous file, like ":e #"
3071 Xcount SPC Move right,like l (MOVE)
3072 X ! \s-2mv\s+2 Run the selected lines thru an external filter program
3073 X " \s-2key\s+2 Select which cut buffer to use next
3074 Xcount # \s-2+\s+2 Increment a number (EDIT) (EXT)
3075 X $ Move to the rear of the current line (MOVE)
3076 Xcount % Move to matching (){}[] or to a given % of file (MOVE) (EXT)
3077 Xcount & Repeat the previous ":s//" command here (EDIT)
3078 X ' \s-2key\s+2 Move to a marked line (MOVE)
3079 Xcount ( Move backward <count> sentences (MOVE)
3080 Xcount ) Move forward <count> sentences (MOVE)
3081 X * Go to the next error in the errlist (EXT)
3082 Xcount + Move to the front of the next line (MOVE)
3083 Xcount , Repeat the previous [fFtT] but in the other direction (MOVE)
3084 Xcount - Move to the front of the preceding line (MOVE)
3085 Xcount . Repeat the previous "edit" command
3086 X / \s-2text\s+2 Search forward for a given regular expression (MOVE)
3087 X 0 If not part of count, move to 1st char of this line (MOVE)
3097 X : \s-2text\s+2 Run single EX cmd
3098 Xcount ; Repeat the previous [fFtT] cmd (MOVE)
3099 X < \s-2mv\s+2 Shift text left (EDIT)
3100 X = \s-2mv\s+2 Reformat
3101 X > \s-2mv\s+2 Shift text right (EDIT)
3102 X ? \s-2text\s+2 Search backward for a given regular expression (MOVE)
3103 X @ \s-2key\s+2 Execute the contents of a cut-buffer as VI commands
3104 Xcount A \s-2inp\s+2 Append at end of the line (EDIT)
3105 Xcount B Move back Word (MOVE)
3106 X C \s-2inp\s+2 Change text from the cursor through the end of the line (EDIT)
3107 X D Delete text from the cursor through the end of the line (EDIT)
3108 Xcount E Move end of Word (MOVE)
3109 Xcount F \s-2key\s+2 Move leftward to a given character (MOVE)
3110 Xcount G Move to line #<count> (default is the bottom line) (MOVE)
3111 Xcount H Move to home row (the line at the top of the screen)
3112 Xcount I \s-2inp\s+2 Insert at the front of the line (after indents) (EDIT)
3113 Xcount J Join lines, to form one big line (EDIT)
3114 X K Look up keyword (EXT)
3115 Xcount L Move to last row (the line at the bottom of the screen)
3116 X M Move to middle row
3117 X N Repeat previous search, but in the opposite direction (MOVE)
3118 Xcount O \s-2inp\s+2 Open up a new line above the current line (EDIT)
3119 X P Paste text before the cursor (EDIT)
3121 X R \s-2inp\s+2 Overtype (EDIT)
3122 Xcount S \s-2inp\s+2 Change lines, like <count>cc
3123 Xcount T \s-2key\s+2 Move leftward *almost* to a given character (MOVE)
3124 X U Undo all recent changes to the current line
3125 X V Start marking lines for c/d/y/</>/!/\\ (EXT)
3126 Xcount W Move forward <count> Words (MOVE)
3127 Xcount X Delete the character(s) to the left of the cursor (EDIT)
3128 Xcount Y Yank text line(s) (copy them into a cut buffer)
3129 X Z Z Save the file & exit
3130 X [ [ Move back 1 section (MOVE)
3131 X \\ \s-2mv\s+2 Pop-up menu for modifying text (EXT)
3132 X ] ] Move forward 1 section (MOVE)
3133 X ^ Move to the front of the current line (after indent) (MOVE)
3134 Xcount _ Move to the current line
3135 X ` \s-2key\s+2 Move to a marked character (MOVE)
3136 Xcount a \s-2inp\s+2 Insert text after the cursor (EDIT)
3137 Xcount b Move back <count> words (MOVE)
3138 X c \s-2mv\s+2 Change text (EDIT)
3139 X d \s-2mv\s+2 Delete text (EDIT)
3140 Xcount e Move forward to the end of the current word (MOVE)
3141 Xcount f \s-2key\s+2 Move rightward to a given character (MOVE)
3143 Xcount h Move left (MOVE)
3144 Xcount i \s-2inp\s+2 Insert text at the cursor (EDIT)
3145 Xcount j Move down (MOVE)
3146 Xcount k Move up (MOVE)
3147 Xcount l Move right (MOVE)
3148 X m \s-2key\s+2 Mark a line or character
3149 X n Repeat the previous search (MOVE)
3150 Xcount o \s-2inp\s+2 Open a new line below the current line (EDIT)
3151 X p Paste text after the cursor (EDIT)
3153 Xcount r \s-2key\s+2 Replace <count> chars by a given character (EDIT)
3154 Xcount s \s-2inp\s+2 Replace <count> chars with text from the user (EDIT)
3155 Xcount t \s-2key\s+2 Move rightward *almost* to a given character (MOVE)
3156 X u Undo the previous edit command
3157 X v Start marking characters for c/d/y/</>/!/\\ (EXT)
3158 Xcount w Move forward <count> words (MOVE)
3159 Xcount x Delete the character that the cursor's on (EDIT)
3160 X y \s-2mv\s+2 Yank text (copy it into a cut buffer)
3161 X z \s-2key\s+2 Scroll current line to the screen's +=top -=bottom .=middle
3162 Xcount { Move back <count> paragraphs (MOVE)
3163 Xcount | Move to column <count> (the leftmost column is 1)
3164 Xcount } Move forward <count> paragraphs (MOVE)
3165 Xcount ~ Switch a character between uppercase & lowercase (EDIT)
3166 X DEL --- (usually mapped to shift-X, so it deletes one character)
3169 XMany commands may be preceded by a count. This is a sequence of digits
3170 Xrepresenting a decimal number. For most commands that use a count,
3171 Xthe command is repeated <count> times. The count is always optional,
3172 Xand usually defaults to 1.
3174 XSome commands require two keystrokes. The first key always determines
3175 Xwhich command is to be executed. The second key is used as a parameter
3178 XSome commands (! < > c d y \\ =) operate on text between the cursor and some
3180 XThere are three ways that you can specifify that other position.
3182 XThe first way is to follow the command keystroke with a movement command.
3183 XFor example, "dw" deletes a single word.
3184 X"d3w" and "3dw" both delete three words.
3186 XThe second way is to type the command keystroke twice.
3187 XThis causes whole lines to be acted upon.
3188 XFor example, ">>" indents the current line.
3189 X"3>>" indents the current line and the following two lines.
3191 XThe last way is to move the cursor to one end of the text,
3192 Xtype 'v' or 'V' to start marking,
3193 Xmove the cursor to the other end,
3194 Xand then type the desired command key.
3196 XMany commands allow the user to interactively enter text.
3197 XSee the discussion of "input mode" in the following section.
3199 XThese commands are extensions -- the real vi doesn't have them.
3201 XThese commands affect text, and may be repeated by the "." command.
3203 XThese commands move the cursor, and may be used to specify the extent
3204 Xof a member of the "mv" class of commands.
3208 XYou can't type text into your file directly from visual command mode.
3209 XInstead, you must first give a command which will put you into input mode.
3210 XThe commands to do this are A/C/I/O/R/S/a/i/o/s.
3212 XThe S/s/C/c commands temporarily place a $ at the end of the text that
3213 Xthey are going to change.
3215 XIn input mode, all keystrokes are inserted into the text at the
3216 Xcursor's position, except for the following:
3218 X^A insert a copy of the last input text
3219 X^D delete one indent character
3220 X^H (backspace) erase the character before the cursor
3221 X^L redraw the screen
3222 X^M (carriage return) insert a newline (^J, linefeed)
3223 X^O execute next key as a visual command (limited!)
3224 X^P insert the contents of the cut buffer
3225 X^R redraw the screen, like ^L
3226 X^T insert an indent character
3227 X^U backspace to the beginning of the line
3228 X^V insert the following keystroke, even if special
3229 X^W backspace to the beginning of the current word
3230 X^Z^Z write the file & exit \*E
3231 X^[ (ESCape) exit from input mode, back to command mode
3234 XAlso, on some systems, ^S may stop output, ^Q may restart output,
3235 Xand ^C may interupt execution.
3236 X^@ (the NUL character) cannot be inserted.
3238 XThe R visual command puts you in overtype mode,
3239 Xwhich is a slightly different form of input mode.
3240 XIn overtype mode, each time you insert a character,
3241 Xone of the old characters is deleted from the file.
3243 XArrow keys in Input Mode
3245 XThe arrow keys can be used to move the cursor in input mode.
3246 X(This is an extension; the real Vi doesn't support arrow keys in input mode.)
3247 XThe <PgUp>, <PgDn>, <Home>, and <End> keys work in input mode, too.
3248 XThe <Delete> key deletes a single character in input mode.
3249 XThe <Insert> key toggles between input mode and replace mode.
3251 XThe best thing about allowing arrow keys to work in input mode is that
3252 Xas long as you're in input mode,
3253 X\*E seems to have a fairly ordinary user interface.
3254 XWith most other text editors, you are always in either insert mode or
3255 Xreplace mode, and you can use the arrow keys at any time to move the cursor.
3256 XNow, \*E can act like that, too.
3257 XIn fact, with the new "inputmode" option and the "control-Z control-Z" input
3258 Xcommand, you may never have to go into visual command mode for simple edit
3263 X\*E supports digraphs as a way to enter non-ASCII characters.
3264 XA digraph is a character which is composed of two other characters.
3265 XFor example, an apostrophe and the letter i could be defined as a digraph
3266 Xwhich is to be stored & displayed as an accented i.
3268 XThere is no single standard for extended ASCII character sets.
3269 X\*E can be compiled to fill the digraph with values appropriate for
3270 Xeither the IBM PC character set, or the LATIN-1 character set used by
3271 XX windows, or neither.
3272 X(See the discussions of -DCS_IBMPC and -DCS_LATIN1 in the CFLAGS section
3274 XYou can view or edit the digraph table via the ":digraph" colon command.
3276 XDigraphs will not be recognized until you've entered ":set digraph".
3278 XTo actually use a digraph
3279 Xtype the first character, then hit <Backspace>, and then type the
3281 X\*E will then substitute the non-ASCII character in their place.
3285 X\*E can expand abbreviations for you.
3286 XYou define an abbreviation with the :abbr command,
3287 Xand then whenever you type in the abbreviated form while in input mode,
3288 X\*E will immediately replace it with the long form.
3289 XCOBOL programmers should find this useful. :-)
3291 X\*E doesn't perform the substitution until you type a non-alphanumeric
3292 Xcharacter to mark the end of the word.
3293 XIf you type a control-V before that non-alphanumeric character, then
3294 X\*E will not perform the substitution.
3298 XWith the ":set autoindent" option turned on,
3299 X\*E will automatically insert leading whitespace at the beginning of each
3300 Xnew line that you type in.
3301 XThe leading whitespace is copied from the preceding line.
3303 XTo add more leading whitespace, type control-T.
3304 XTo remove some whitespace, type control-D.
3306 XIf you ":set noautotab", then the whitespace generated by control-T will
3307 Xalways consist of spaces -- never tabs.
3308 XSome people seem to prefer this.
3310 X\*E' autoindent mode isn't 100% compatible with vi's.
3311 XIn \*E, 0^D and ^^D don't work,
3312 X^U can wipeout all indentation,
3313 Xand sometimes \*E will use a different amount of indentation than vi would.