home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
mactosh
/
utilfil
/
stevie31.sit
/
stevie.doc
next >
Wrap
Text File
|
1988-10-11
|
10KB
|
270 lines
STEVIE - An Aspiring VI Clone
User Reference
Tony Andrews
3/6/88
Macintosh Port by
Earle Horton 10/10/88
Overview
--------
STEVIE is an editor designed to mimic the interface of the UNIX editor
'vi'. The name (ST Editor for VI Enthusiasts) is due to the fact that
the editor was first written for the Atari ST. The current version has
been ported to UNIX and OS/2, but I've left the name intact for now.
I've labelled STEVIE an 'aspiring' vi clone as a warning to those who
may expect too much. On the whole, the editor is pretty complete. Almost
all of the visual mode commands are supported. The biggest failing at the
moment is that the undo command is currently in a state of disrepair.
Recent enhancements in other areas have required the undo command to be
mostly disabled until it can catch up with the other changes. But don't be
discouraged. I've tried very hard to capture the 'feel' of vi by getting
the little things right. Making lines wrap correctly, supporting true
operators, and even getting the cursor to land on the right place for
tabs are all a real pain, but do much to make the editor feel right.
This program is the result of many late nights of hacking over the last
several months. The first version was written by Tim Thompson and posted
to USENET. From there, I reworked the data structures completely, added
LOTS of features, and generally improved the overall performance in the
process.
STEVIE may be freely distributed. The source isn't copyrighted or
restricted in any way. If you pass the program along, please include all
the documentation and, if practical, the source as well. I'm not fanatical
about this, but I tried to make STEVIE fairly portable and that doesn't
do any good if the source isn't available.
The remainder of this document describes the operation of the editor.
This is intended as a reference for users already familiar with the real
vi editor.
Starting the Editor
-------------------
The following command line forms are supported:
vi [file ...] Edit the specified file(s)
vi -t tag Start at location of the given tag
vi + file Edit file starting at end
vi +n file Edit file starting a line number 'n'
vi +/pat file Edit file starting at pattern 'pat'
If multiple files are given on the command line (using the first form),
the ":n" command goes to the next file, ":p" goes backward in the list,
and ":rew" can be used to rewind back to the start of the file list.
Set Command Options
-------------------
The ":set" command works as usual to set parameters. Each parameter has
a long and an abbreviated name, either of which may be used. Boolean
parameters are set as in:
set showmatch
or cleared by:
set noshowmatch
Numeric parameters are set as in:
set scroll=5
Several parameters may be set with a single command:
set novb sm report=1
To see the status of all parameters use ":set all". Typing ":set" with
no arguments will show only those parameters that have been changed.
The supported parameters, their names, defaults, and descriptions are
shown below:
Full Name Short Default Description
------------------------------------------------------------------------------
vbell vb vb Use visual bell (novb for audible bell)
showmatch sm nosm Showmatch mode
wrapscan ws ws Wrapscan (searches cross file start/end)
errorbells eb noeb Ring bell when error messages are shown
showmode mo nomo Show on status line when in insert mode
backup bk nobk Leave backup in *.bak on file writes
return cr cr End lines with cr-lf when writing
list list nolist Show tabs and newlines graphically
scroll scroll 12 Number of lines to scroll for ^D and ^U
tabstop ts 8 Number of spaces in a tab
report report 5 Min # of lines to report operations on
lines lines 25 Number of lines on the screen
The EXINIT environment variable can be used to modify the default values
on startup as in:
setenv EXINIT="set sm ts=4"
The 'backup' parameter, if set, causes the editor to retain a backup of any
files that are written. During file writes, a backup is always kept for
safety until the write is completed. At that point, the 'backup' parameter
determines whether the backup file is deleted.
In environments (e.g. OS/2 or TOS) where lines are normally terminated by
CR-LF, the 'return' parameter allows files to be written with only a LF
terminator (if the parameter is cleared).
The 'lines' parameter tells the editor how many lines there are on the screen.
This is useful on systems like the ST where various screen resolutions may be
used. By using the 'lines' parameter, different screen sizes can be easily
handled.
File Manipulation Commands
--------------------------
The following table shows the supported file manipulation commands as
well as some other 'ex' commands that aren't described elsewhere:
:w write the current file
:wq write and quit
:x write (if necessary) and quit
ZZ same as ":x"
:e file edit the named file
:e! re-edit the current file, discarding any changes
:e # edit the alternate file
:w file write the buffer to the named file
:x,y w file write lines x through y to the named file
:r file read the named file into the buffer
:n edit the next file
:p edit the previous file
:rew rewind the file list
:f show the current file name
:f name change the current file name
:ta tag go to the named tag
^] like ":ta" using the current word as the tag
:help display a command summary
The ":help" command can also be invoke with the <HELP> key on the Atari
ST. This actually displays a pretty complete summary of the real vi with
unsupported features indicated appropriately.
The commands above work pretty much like they do in 'vi'. Most of the
commands support a '!' suffix (if appropriate) to discard any pending
changes.
When writing just part of the buffer, the following address forms are
supported:
addr [+- number]
where 'addr' may be one of the following:
a line number
a mark (as in 'a or 'b)
'.' (the current line)
'$' (the last line)
String Searches
---------------
String searches are supported, as in vi, accepting the usual regular
expression syntax. This was done using Henry Spencer's regular expression
library without modification. I added code outside the library to support
the '\<' and '\>' extensions. This actually turned out to be pretty easy.
Operators
---------
The vi operators (d, c, y, <, and >) work as true operators. The only
exception is that the change operator works only for character-oriented
changes (like cw or c%) and not for line-oriented changes (like cL or c3j).
Tags
----
Tags are implemented and a fairly simple version of 'ctags' is supplied
with the editor. The current version of ctags will find functions and
macros following a specific (but common) form. See 'ctags.doc' for a
complete discussion. [The full Ctags program is in the public domain;
contact your nearest comp.sources.unix archive site; the primitive
tags has been taken out of this c.s.u distribution.]
System-Specific Comments
------------------------
The following sections provide additional relevant information for the
systems to which STEVIE has been ported.
Atari ST
--------
The editor has been tested in all three resolutions, although low and
high res. are less tested than medium. The 50-line high res. mode can
be used by setting the 'l
Note: It looks like the shar file I got the original copy from is
missing a line or two here. Sorry. Earle
Macintosh This section by Earle Horton
---------
The Macintosh version was ported by me and compiled using Aztec C v 3.6c.
I made very few changes to the original code, but did provide a terminal
emulator for the program to run in on the Mac, and also a faster malloc()
than supplied with Aztec C. The EXINIT environment variable mentioned
above is mimiced by the 'STR ' resource named "EXINIT." I have added a
"columns" parameter to control the width of the terminal emulator window.
You can take over most of the screen on a Mac II with the Apple color
monitor by putting "set lines=36 columns=105" in the "EXINIT" resource
using ResEdit, or by typing it on the command line.
The only major shortcomings in the Mac version of Stevie are the inability
to change the current working directory, and my failure to use Standard
File dialogs to access files. But when did the real vi have these
features? I realize that this behavior violates Apple User Interface
Guidelines, but if I were to add Standard File dialogs, then it would
loose the vi "Look and Feel," now wouldn't it?
So that no one will be inconvenienced by these un-Mac-ish items, allow
me to describe how Stevie is used with HFS disks. One launches Stevie
by clicking on its icon or on a document icon. The default folder for
all file access is set to the folder Stevie is in, or to the folder
containing THE LAST FILE IN THE FINDER PARAMETER LIST. This is the
last file passed to Stevie by the Finder. Since there is no way to
control which file this will be, it is unwise to launch Stevie from
MPW Shell with a list of files in different folders. Sorry. All files
which are not in the default folder thus defined must be accessed by
pathname. Either absolute pathnames or relative pathnames may be used.
If relative pathnames are used, they must be defined with reference
to the default Stevie folder.
One final note. Stevie understands Macintosh extended character set
characters, and can handle long lines, but it dislikes nul characters
and breaks lines longer than 1023 characters. For this reason it should
not be used to edit binary files, although it may be used to view such
files with impunity. I realize that this is unlike the behavior of the
"real" vi, but one has to make concessions occasionally.