home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d162
/
avi
/
avi.doc
< prev
next >
Wrap
Text File
|
1988-10-02
|
9KB
|
275 lines
AVI 1.0
The program avi is a workalike version of UN*X vi for the Amiga. It is
intended to provide vi users, who tend to be a rather hardcore lot, with
their favorite text editor. Version 1.0 implements only a subset of
standard vi, has a few intentional changes, and many (minor) unintentional
changes. I have used it extensively and have 97% confidence in its
suitability for intended use. Nevertheless, users should be aware that
it has not been tested in a variety of configurations and due care should
be exercised when editting important files.
Avi is not a user-friendly program. The following summary is not intended
to supplant the published tutorials and user guides for vi. It will
point out the implemented features and differences of avi, and provide
a refresher for experienced users.
Even the most experienced users should read the section on searching
and replacement, as their are many (intentional) changes there.
Modes:
Avi has two modes of operation: command mode and input mode.
You can tell which mode the program is in by the color of the
cursor. With the default preference pallete, an orange
cursor indicates command mode and a white cursor indicates
input mode. In command mode, keystrokes are interpreted as
commands. In input mode, keystrokes are entered into the file.
Command mode is entered by issuing one of the input commands
listed below. Input mode is ended by typing ESC.
Autoindent mode (see below) is useful when writing programs.
When in insert mode, each new line is indented as far as
the previous one. Note that in autoindent mode, the leading
white space is rewritten using the fewest number of spaces
and tabs needed to accomplish this indentation, and in
particular lines containing only white space are completely
truncated.
NB: There is no notion of ^T, i.e. software tabs. ^T enters
a tab character.
Commands:
Counts before commands repeat their effect.
Operators are followed by a cursor motion to limit
their range. Stuttered operators (e.g. dd) limit
the range to the current line (e.g. dd deletes the
current line).
File commands:
The only file commands implemented are
:wCR -- write to the editted file
:qCR -- exit the program
:q!CR -- exit the program, discard changes.
^G -- show line number
Positioning commands:
^F -- forward one screenful
^B -- backward one screenful
^D -- scroll down 1/2 screenful
^U -- scroll up 1/2 screenful
^L -- redraw screen
Cursor motion:
CR -- first non-white on next line
+ -- first non-white on next line
- -- first non-white on previous line
^ -- first non-white on same line
0 -- first character on same line
ng -- goto n'th line
G -- goto last line
j -- next line, same column (also up arrow)
k -- previous line, same column (also down arrow)
h -- previous character (also left arrow, ^H)
i -- next character (also right arrow, SPACE)
w -- forward one word
W -- forward one blank delimited word
b -- backward one word
B -- backward one blank delimited word
fx -- find character x forward
tx -- to character before x
F -- find character x backward
T -- to character x backward
; -- repeat last f t F T
, -- repeat last f t F T in opposite direction
% -- find matching (), [], or {}
Operators:
d -- delete
c -- change, enter input mode overwriting
the characters indicated by the cursor
motion, then insert characters.
y -- yank to buffer
< -- shift left
> -- shift right
Yank, Put, and buffers.
The yank operator yanks characters from the text
and puts them into a buffer. The buffer may be
specified by prefixing with a "x where x is an
alphabetic buffer name. Hence "ay+ yanks the
current line and the next line to the buffer a
"ap puts the contents of buffer a after the cursor.
Delete also puts the deleted text into a buffer, and
may be used with a named buffer. Hence "add deletes
the current line and puts it into buffer a. If a
buffer is not specified, it goes into the numbered
buffer 1. The numbered buffers are rolled on each
yank and delete. Hence 1 contains the last text
yanked or deleted, 2 contains the next to last text,
and so on, up to buffer 9.
p -- put most recently yanked text after cursor
P -- put most recently yanked text before cursor
"xp -- put text from buffer x
"xP -- put text from buffer x
"xy -- yank text to buffer x
Undo and repeat:
u -- undo the last change
. -- repeat the last change
Input mode:
r -- replace character under cursor
a -- append characters after cursor
i -- insert characters befor cursor
A -- append at end of line
I -- insert before first non-white
o -- open line below
O -- open line above
^H -- backspace, erase last character entered
^D -- same as ^H
^W -- erase last word entered
^X -- erase all input entered
ESC -- end input mode
Abbreviations and join:
C -- change to end of line (c$)
D -- delete to end of line (d$)
s -- substitute (cl)
x -- delete character (dl)
X -- delete character before cursor (dh)
Y -- yank lines (yy)
J -- join next line with current line
Mark and return:
mx -- mark current location as x.
'x -- goto first non-white in line with mark x.
`x -- goto mark x.
'' -- not supported.
Search and replace:
/pat -- search forward for pat
?pat -- search backward for pat
n -- search in same direction for same pat
N -- search in opposite direction for same pat
:s/pat/rpat -- replace all occurances of pat with rpat
(NOTE: selective search and replace is accomplished
with judicious use of search, change and
redo commands.)
NB: / finds the first occurance of pat starting from the line after
the current one. ? does the same except it starts from the
previous line. N and n, when searching backwards, do the same.
However N and n, when searching forwards, starts from the current
cursor position. This last is an intentional deviation from
the vi practice. I put it in to facilitate selective replacement
using n and . commands.
The search and replace commands are different from vi standards. First,
:s is a global search and replace. No line addressing here. Second,
the patterns are based on the Amiga pattern syntax, e.g. #, ?, |, etc.
Also included are character classes using [].
NB: PATTERN CHARACTERS ARE ENTERED USING ALT-X TO ENTER THE PATTERN
METACHAR X. THIS WILL ECHO IN ORANGE TO HIGHLIGHT IT'S METACHAR
NATURE. THE ALT- IS SUPPRESSED IN THE INTEREST OF READABILITY
IN THE NEXT SECTION.
A summary of the pattern metacharacters is:
#pat -- 0 or more occurances of pat.
? -- any character.
% -- null string.
p|q -- matches patterns matching pattern p or pattern q.
(pat) -- for grouping patterns.
[string] -- matches any character in string.
[a-z] -- matches any character between a and z inclusive.
according to the ascii collating sequence.
[^string] -- matches any character not in string.
[^a-z] -- matches any character not between a and z inclusive.
Parenthesis, in addition to their use in grouping, also identify
parts of the matched pattern useful in replacement. The entire
string matched is denoted by \0. The string matched by the first
parenthesized subpattern by \1, etc. For example:
:s/a|an/xxx\0xxx
would change "this is an outrage" to "this is xxxanxxx outrxxxaxxxge"
and
:s/([abc])([efg])/\2\1
would change "af xx bg xx ce" to "fa xx gf xx ec"
Parenthesized subexpressions which are one alternative in an or expression
have an undefined value if that alternative is not taken. Never use
them in a replacement pattern.
For example :s/(abc)|(def)/\1 is useless.
but :s/abc(e|f)gh)/\1 is fine.
Sets:
:set -- display current settings
:set ws -- set wrapscan on
:set ai -- set autoindent on
:set ic -- set ignore case for searches on
:set nows -- set wrapscan off
:set noai -- set autoindent off
:set noic -- set ignore case for searches off
:set numb -- set tabsize
More than one flag may be specified in a set command.
Wrapscan means wrap around the top and bottom of the
file when searching.
Autoindent is explained above unders modes.
Ignore case ignores the case of alphabetic characters
during searches. Ignore case is ignored inside of
character class specifications.
Tabsize has the obvious meaning. It is also the size
used for <, > (the shiftwidth of vi). In avi, hard tabs (\t)
and software tabs (^T) are confounded.
The default setting is "nows noai ic 8"
Caveats:
Avi eats memory. It will die a horrible death if starved.
Do not use with less than 150K or so of free memory. But
if you have enough memory to run alink, you have enough
for avi.
Avi has been known to die mysteriously when used
with BlitzFonts.
Avi only understands the default 80 character font.
Very occaisionally, after an undo, the screen display
is improper. ^L fixes this.
Avi is limited to editting files of 4000 lines or fewer,
and refuses to edit files with lines longer than 256.
It does not wrap long lines or provide horizontal
scrolling.
Bug reports, complaints, and suggestions may be sent to:
Peter Nestor
Compuserve 70721,2335