[comp.sources.misc] v08i008: stevie 3.69 - part 6 of 8

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (08/20/89)

Posting-number: Volume 8, Issue 8
Submitted-by: tony@cs.utexas.edu@wldrdg.UUCP (Tony Andrews)
Archive-name: stevie3.68/part06

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	term.h
#	version.c
#	stevie.mm
# This archive created: Sun Aug 13 11:46:10 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'term.h'" '(4726 characters)'
if test -f 'term.h'
then
	echo shar: will not over-write existing file "'term.h'"
else
sed 's/^X//' << \HE_HATES_THESE_CANS > 'term.h'
X/* $Header: /nw/tony/src/stevie/src/RCS/term.h,v 1.7 89/08/01 17:25:18 tony Exp $
X *
X * System-dependent escape sequence definitions.
X */
X
X#ifdef	TERMCAP
X
Xextern char *T_EL;		/* erase the entire current line */
Xextern char *T_IL;		/* insert one line */
Xextern char *T_DL;		/* delete one line */
Xextern char *T_SC;		/* save the cursor position */
Xextern char *T_ED;		/* erase display (may optionally home cursor) */
Xextern char *T_RC;		/* restore the cursor position */
Xextern char *T_CI;		/* invisible cursor (very optional) */
Xextern char *T_CV;		/* visible cursor (very optional) */
X
Xextern char *T_CM;		/* cursor motion string */
X
X#else
X
X/*
X * This file contains the machine dependent escape sequences that
X * the editor needs to perform various operations. Some of the sequences
X * here are optional. Anything not available should be indicated by
X * a null string. In the case of insert/delete line sequences, the
X * editor checks the capability and works around the deficiency, if
X * necessary.
X *
X * Currently, insert/delete line sequences are used for screen scrolling.
X * There are lots of terminals that have 'index' and 'reverse index'
X * capabilities, but no line insert/delete. For this reason, the editor
X * routines s_ins() and s_del() should be modified to use 'index'
X * sequences when the line to be inserted or deleted line zero.
X */
X
X/*
X * The macro names here correspond (more or less) to the actual ANSI names
X */
X
X#ifdef	ATARI
X#ifdef	MINIX
X
X#define	T_EL	"\033[2K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert one line */
X#define	T_DL	"\033[M"	/* delete one line */
X#define	T_SC	"\0337"		/* save the cursor position */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_RC	"\0338"		/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X
X#else
X
X#define	T_EL	"\033l"		/* erase the entire current line */
X#define	T_IL	"\033L"		/* insert one line */
X#define	T_DL	"\033M"		/* delete one line */
X#define	T_SC	"\033j"		/* save the cursor position */
X#define	T_ED	"\033E"		/* erase display (may optionally home cursor) */
X#define	T_RC	"\033k"		/* restore the cursor position */
X#define	T_CI	"\033f"		/* invisible cursor (very optional) */
X#define	T_CV	"\033e"		/* visible cursor (very optional) */
X
X#endif
X#endif
X
X#ifdef	UNIX
X/*
X * The following sequences are hard-wired for ansi-like terminals. To get
X * termcap support, define TERMCAP in env.h and these sequences go away.
X */
X#define	T_EL	"\033[2K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert one line */
X#define	T_DL	"\033[M"	/* delete one line */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_SC	"\0337"		/* save the cursor position */
X#define	T_RC	"\0338"		/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X#endif
X
X#ifdef	OS2
X/*
X * The OS/2 ansi console driver is pretty deficient. No insert or delete line
X * sequences. The erase line sequence only erases from the cursor to the end
X * of the line. For our purposes that works out okay, since the only time
X * T_EL is used is when the cursor is in column 0.
X *
X * The insert/delete line sequences marked here are actually implemented in
X * the file os2.c using direct OS/2 system calls. This makes the capability
X * available for the rest of the editor via appropriate escape sequences
X * passed to outstr().
X */
X#define	T_EL	"\033[K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert one line - fake (see os2.c) */
X#define	T_DL	"\033[M"	/* delete one line - fake (see os2.c) */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_SC	"\033[s"	/* save the cursor position */
X#define	T_RC	"\033[u"	/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X#endif
X
X#ifdef	DOS
X/*
X * DOS sequences
X *
X * Some of the following sequences require the use of the "nansi.sys"
X * console driver. The standard "ansi.sys" driver doesn't support
X * sequences for insert/delete line.
X */
X#define	T_EL	"\033[K"	/* erase the entire current line */
X#define	T_IL	"\033[L"	/* insert line (requires nansi.sys driver) */
X#define	T_DL	"\033[M"	/* delete line (requires nansi.sys driver) */
X#define	T_ED	"\033[2J"	/* erase display (may optionally home cursor) */
X#define	T_SC	"\033[s"	/* save the cursor position */
X#define	T_RC	"\033[u"	/* restore the cursor position */
X#define	T_CI	""		/* invisible cursor (very optional) */
X#define	T_CV	""		/* visible cursor (very optional) */
X#endif
X
X#endif
HE_HATES_THESE_CANS
if test 4726 -ne "`wc -c < 'term.h'`"
then
	echo shar: error transmitting "'term.h'" '(should have been 4726 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'version.c'" '(13169 characters)'
if test -f 'version.c'
then
	echo shar: will not over-write existing file "'version.c'"
else
sed 's/^X//' << \HE_HATES_THESE_CANS > 'version.c'
Xstatic	char	RCSid[] =
X"$Header: /nw/tony/src/stevie/src/RCS/version.c,v 3.69 89/08/13 11:41:58 tony Exp $";
X
X/*
X * Contains the declaration of the global version number variable.
X *
X * $Log:	version.c,v $
X * Revision 3.69  89/08/13  11:41:58  tony
X * Fixed a bug that caused messages from fileinfo() (in misccmds.c) to get
X * screwed up. The routine smsg() which uses the kludge approach to varargs
X * didn't have enough parameters for some of the calls made to it.
X * 
X * Revision 3.68  89/08/06  09:51:20  tony
X * Misc. minor changes to make lint happier before posting to USENET.
X * 
X * Revision 3.67  89/08/03  13:08:52  tony
X * There was some code in ops.c that was duplicating the function of the
X * getcmdln() routine in cmdline.c. I modified getcmdln() to be slightly
X * more general, and changed dofilter() in ops.c to use it.
X * 
X * Revision 3.66  89/08/02  20:00:12  tony
X * Fixed some problems with mode lines. There were still extra screen
X * redraws that needed to be avoided. There was also a problem involving
X * nested calls to docmdln() that can occur when mode lines are used.
X * 
X * Revision 3.65  89/08/02  15:50:03  tony
X * Finally got around to providing full support for the "change" operator.
X * Multi-line changes (like "cL" or "3cc") now work correctly. Also fixed
X * a small problem with multi-line character-oriented deletes leaving the
X * cursor in the wrong location (off by one character). This is mainly
X * useful for multi-line changes (such as "c%") so the insert starts in
X * the right place.
X * 
X * Revision 3.64  89/08/02  12:47:04  tony
X * This message intentionally left blank.
X * 
X * Revision 3.63  89/08/02  12:43:44  tony
X * I just noticed that I had used the RCS cookie for log messages in one
X * of my prior version messages. This caused these version update messages
X * to be duplicated in this file. I just removed that string, and the
X * extra message copies that had been generated.
X * 
X * Revision 3.62  89/08/02  12:26:20  tony
X * The ^G command now shows where you are in the file list, if more than one
X * file is being edited. Also, the commands ":e#" and ":e!#" (note the lack
X * of a space between the command and file name) will now work.
X * 
X * Revision 3.61  89/08/02  11:03:16  tony
X * Misc. cleanups regarding tags. Also added support for the "terse" option.
X * This is ignored, but improves compatibility with vi, since we no longer
X * complain about an unknown option if "terse" is used.
X * 
X * Revision 3.60  89/08/02  09:26:39  tony
X * Added code to avoid screen redraws when input is being read from the
X * "stuffin" buffer. This avoids extra redraws when switching to the
X * alternate file, or when invoking the editor with one of the "+" options,
X * or when using tags.
X * 
X * Revision 3.59  89/08/01  16:28:31  tony
X * Added better support for counts on several cursor motion commands. These
X * include ^F, ^B, f, F, t, T, as well as the repeated character search
X * commands (command and semi-colon).
X * 
X * Revision 3.58  89/07/19  08:08:23  tony
X * Added the ability for '~' to be an operator. If enabled (by defined TILDEOP
X * in env.h), the parameter "tildeop" (or "to") may be set to turn tilde into
X * an operator.
X * 
X * Revision 3.57  89/07/13  22:47:05  tony
X * Made some generic speed improvements in screen.c and some TOS-specific
X * improvements in tos.c. The TOS version is now much faster at screen
X * updates than before.
X * 
X * Revision 3.56  89/07/13  14:52:03  tony
X * Minor cleanups in normal.c
X * 
X * Revision 3.55  89/07/13  14:19:12  tony
X * Cleaned up the logic in getcmdln() A LOT. The routine docmdln() needs a
X * similar overhaul.
X * 
X * Revision 3.54  89/07/12  21:40:01  tony
X * Lots of misc. cleanup in normal.c and cmdline.c, but nothing much in the
X * way of functional improvements. One change is that things like d/foo<CR>
X * will now work since searches are less of a special case now.
X * 
X * Revision 3.53  89/07/11  16:16:08  tony
X * Added general support for interrupt-handling for those environments that
X * can actually generate them. Basically, long-running operations are now
X * able to terminate early if an error occurs. These operations are: string
X * searches, the global command (":g/.../"), and file reads. File writes
X * should probably be done as well, but this is more dangerous. In all cases,
X * the user is given an indication on the status line that the operation
X * terminated due to an interrupt.
X * 
X * Revision 3.52  89/07/11  12:35:09  tony
X * Improved the code in dosub() and doglob() that detects quoted characters
X * and delimiters in search strings and replacement patterns. The current
X * code didn't allow certain valid strings to be used. The delimiter is still
X * required to be '/', but it can be quoted reliably now with backslash.
X * 
X * Revision 3.51  89/07/10  14:01:58  tony
X * Removed the function addtobuff() since it was rarely used and could be
X * replaced by calls to other library functions. Also removed some other
X * obsolete code that was already ifdef'd out anyway.
X * 
X * Revision 3.50  89/07/10  13:10:32  tony
X * Added a workaround in normal.c to avoid problems with broken versions of
X * strncpy() that don't properly deal with a count of zero.
X * 
X * Revision 3.49  89/07/07  16:28:37  tony
X * Fixed a long-standing bug with 'cw' when the cursor is positioned on a
X * word with only one character. Also fixed a problems with zero-length files
X * and reverse searches.
X * 
X * Revision 3.48  89/03/22  10:26:58  tony
X * Fixed some outdated uses of the ":p" command (which has been changed to
X * ":N" in os2.c and dos.c. Also added macros (F7 and F8) for dos and os/2
X * to use the "cdecl" program to convert lines to and from a pseudo-english
X * form. Use F7 to "explain" the declaration on the current line, and F8 to
X * convert an english-style declaration to the C form. In both cases, the
X * new form is placed on the next line, leaving the original line intact.
X * 
X * Revision 3.47  89/03/11  22:44:14  tony
X * General cleanup. Removed the static "rcsid" variables and the log
X * strings (except in version.c). Fixed some coding style inconsistencies
X * and added a few register declarations.
X * 
X * Revision 3.46  89/02/14  09:52:07  tony
X * Made a first pass at adding Robert Regn's changes, starting with the
X * more portable ones. Added better support for '#' and '%' in colon
X * commands, support for a configurable temp directory, and made the
X * termcap code less picky about capabilities.
X * 
X * Revision 3.45  88/11/10  09:00:06  tony
X * Added support for mode lines. Strings like "vi:stuff:" or "ex:stuff:"
X * occurring in the first or last 5 lines of a file cause the editor to
X * pretend that "stuff" was types as a colon command. This examination
X * is done only if the parameter "modelines" (or "ml") is set. This is
X * not enabled, by default, because of the security implications involved.
X * 
X * Revision 3.44  88/11/01  21:34:11  tony
X * Fixed a couple of minor points for Minix, and improved the speed of
X * the 'put' command dramatically.
X * 
X * Revision 3.43  88/10/31  13:11:33  tony
X * Added optional support for termcap. Initialization is done in term.c
X * and also affects the system-dependent files. To enable termcap in those
X * environments that support it, define the symbol "TERMCAP" in env.h
X * 
X * Revision 3.42  88/10/27  18:30:19  tony
X * Removed support for Megamax. Added '%' as an alias for '1,$'. Made the
X * 'r' command more robust. Now prints the string on repeated searches.
X * The ':=" command now works. Some pointer operations are now safer.
X * The ":!" and ":sh" now work correctly. Re-organized the help screens
X * a little.
X * 
X * Revision 3.41  88/10/06  10:15:00  tony
X * Fixed a bug involving ^Y that occurs when the cursor is on the last
X * line, and the line above the screen is long. Also hacked up fileio.c
X * to pass pathnames off to fixname() for system-dependent processing.
X * Used under DOS & OS/2 to trim parts of the name appropriately.
X * 
X * Revision 3.40  88/09/16  08:37:36  tony
X * No longer beeps when repeated searches fail.
X * 
X * Revision 3.39  88/09/06  06:51:07  tony
X * Fixed a bug with shifts that was introduced when replace mode was added.
X * 
X * Revision 3.38  88/08/31  20:48:28  tony
X * Made another fix in search.c related to repeated searches.
X * 
X * Revision 3.37  88/08/30  20:37:16  tony
X * After much prodding from Mark, I finally added support for replace mode.
X * 
X * Revision 3.36  88/08/26  13:46:34  tony
X * Added support for the '!' (filter) operator.
X * 
X * Revision 3.35  88/08/26  08:46:01  tony
X * Misc. changes to make lint happy.
X * 
X * Revision 3.34  88/08/25  15:13:36  tony
X * Fixed a bug where the cursor didn't land on the right place after
X * "beginning-of-word" searches if the word was preceded by the start
X * of the line and a single character.
X * 
X * Revision 3.33  88/08/23  12:53:08  tony
X * Fixed a bug in ssearch() where repeated searches ('n' or 'N') resulted
X * in dynamic memory being referenced after it was freed.
X * 
X * Revision 3.32  88/08/17  07:37:07  tony
X * Fixed a general problem in u_save() by checking both parameters for
X * null values. The specific symptom was that a join on the last line of
X * the file would crash the editor.
X * 
X * Revision 3.31  88/07/09  20:39:38  tony
X * Implemented the "line undo" command (i.e. 'U').
X * 
X * Revision 3.30  88/06/28  07:54:22  tony
X * Fixed a bug involving redo's of the '~' command. The redo would just
X * repeat the replacement last performed instead of switching the case of
X * the current character.
X * 
X * Revision 3.29  88/06/26  14:53:19  tony
X * Added support for a simple form of the "global" command. It supports
X * commands of the form "g/pat/d" or "g/pat/p", to delete or print lines
X * that match the given pattern. A range spec may be used to limit the
X * lines to be searched.
X * 
X * Revision 3.28  88/06/25  21:44:22  tony
X * Fixed a problem in the processing of colon commands that caused
X * substitutions of patterns containing white space to fail.
X * 
X * Revision 3.27  88/06/20  14:52:21  tony
X * Merged in changes for BSD Unix sent in by Michael Lichter.
X * 
X * Revision 3.26  88/06/10  13:44:06  tony
X * Fixed a bug involving writing out files with long pathnames. A small
X * fixed size buffer was being used. The space for the backup file name
X * is now allocated dynamically.
X * 
X * Revision 3.25  88/05/04  08:29:02  tony
X * Fixed a minor incompatibility with vi involving the 'G' command. Also
X * changed the RCS version number of version.c to match the actual version
X * of the editor.
X * 
X * Revision 1.12  88/05/03  14:39:52  tony
X * Changed the screen representation of the ascii character DELETE to be
X * compatible with vi. Also merged in support for DOS.
X * 
X * Revision 1.11  88/05/02  21:38:21  tony
X * The code that reads files now handles boundary/error conditions much
X * better, and generates status/error messages that are compatible with
X * the real vi. Also fixed a bug in repeated reverse searches that got
X * inserted in the recent changes to search.c.
X * 
X * Revision 1.10  88/05/02  07:35:41  tony
X * Fixed a bug in the routine plines() that was introduced during changes
X * made for the last version.
X * 
X * Revision 1.9  88/05/01  20:10:19  tony
X * Fixed some problems with auto-indent, and added support for the "number"
X * parameter.
X * 
X * Revision 1.8  88/04/30  20:00:49  tony
X * Added support for the auto-indent feature.
X * 
X * Revision 1.7  88/04/29  14:50:11  tony
X * Fixed a class of bugs involving commands like "ct)" where the cursor
X * motion part of the operator can fail. If the motion failed, the operator
X * was continued, with the cursor position unchanged. Cases like this were
X * modified to abort the operation if the motion fails.
X * 
X * Revision 1.6  88/04/28  08:19:35  tony
X * Modified Henry Spencer's regular expression library to support new
X * features that couldn't be done easily with the existing interface.
X * This code is now a direct part of the editor source code. The editor
X * now supports the "ignorecase" parameter, and multiple substitutions
X * per line, as in "1,$s/foo/bar/g".
X * 
X * Revision 1.5  88/04/24  21:38:00  tony
X * Added preliminary support for the substitute command. Full range specs.
X * are supported, but only a single substitution is allowed on each line.
X * 
X * Revision 1.4  88/04/23  20:41:01  tony
X * Worked around a problem with adding lines to the end of the buffer when
X * the cursor is at the bottom of the screen (in misccmds.c). Also fixed a
X * bug that caused reverse searches from the start of the file to bomb.
X * 
X * Revision 1.3  88/03/24  08:57:00  tony
X * Fixed a bug in cmdline() that had to do with backspacing out of colon
X * commands or searches. Searches were okay, but colon commands backed out
X * one backspace too early.
X * 
X * Revision 1.2  88/03/21  16:47:55  tony
X * Fixed a bug in renum() causing problems with large files (>6400 lines).
X * Also moved system-specific defines out of stevie.h and into a new file
X * named env.h. This keeps volatile information outside the scope of RCS.
X * 
X * Revision 1.1  88/03/20  21:00:39  tony
X * Initial revision
X * 
X */
X
Xchar	*Version = "STEVIE - Version 3.69";
HE_HATES_THESE_CANS
if test 13169 -ne "`wc -c < 'version.c'`"
then
	echo shar: error transmitting "'version.c'" '(should have been 13169 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'stevie.mm'" '(22796 characters)'
if test -f 'stevie.mm'
then
	echo shar: will not over-write existing file "'stevie.mm'"
else
sed 's/^X//' << \HE_HATES_THESE_CANS > 'stevie.mm'
X.\" $Header: /nw/tony/src/stevie/src/RCS/stevie.mm,v 3.69 89/08/13 11:44:04 tony Exp $
X.\"
X.\" Documentation for STEVIE. Process with nroff using the mm macros.
X.\"
X.nr Hu 1
X.SA 1
X.TL
XSTEVIE - An Aspiring VI Clone
X.sp
XUser Reference - 3.69
X.AU "Tony Andrews"
X.AF ""
X.MT 4
X.PH "'STEVIE''User Reference'"
X.PF "''- \\\\nP -''"
X.H 1 "Overview"
XSTEVIE is an editor designed to mimic the interface of the UNIX
Xeditor 'vi'. The name (ST Editor for VI Enthusiasts) comes from the fact that
Xthe editor was first written for the Atari ST. The current version also supports
XUNIX, Minix (ST), MS-DOS, and OS/2, but I've left
Xthe name intact for now.
X.P
XThis program is the result of many late nights of hacking over the last
Xcouple of years.
XThe first version was written by Tim Thompson and posted
Xto USENET. From there, I reworked the data structures completely, added
XLOTS of features, and generally improved the overall performance in the
Xprocess.
X.P
XI've labelled STEVIE an 'aspiring' vi clone as a warning to those who
Xmay expect too much. On the whole, the editor is pretty complete.
XNearly all of the visual mode commands are supported.
XAnd several of the more important 'ex' commands are supported as well.
XI've tried hard to
Xcapture the feel of vi by getting the little things right.
XMaking lines
Xwrap correctly, supporting true operators, and even getting the cursor to
Xland on the right place for tabs are all a pain, but really help make
Xthe editor feel right.
XI've tried to resist the temptation to deviate from the behavior
Xof vi, even where I disagree with the original design.
X.P
XThe biggest problem remaining has to do with the fact that the edit buffer
Xis maintained entirely in memory, limiting the size of files that can
Xbe edited in some environments.
XOther missing features include named buffers and macros.
XPerformance is generally reasonable, although the screen update code
Xcould be more efficient.
XThis is generally only visible on fairly slow systems.
X.P
XSTEVIE may be freely distributed. The source isn't copyrighted or
Xrestricted in any way. If you pass the program along, please include all
Xthe documentation and, if practical, the source as well. I'm not fanatical
Xabout this, but I tried to make STEVIE fairly portable and I'd like to
Xsee as many people have access to the source as possible.
X.P
XThe remainder of this document describes the operation of the editor.
XThis is intended as a reference for users already familiar with the real
Xvi editor.
X.H 1 "Starting the Editor"
XThe following command line forms are supported:
X.VL 20
X.LI "stevie [file ...]"
XEdit the specified file(s)
X.LI "stevie -t tag"
XStart at the location of the given tag
X.LI "stevie + file"
XEdit file starting at end
X.LI "stevie +n file"
XEdit file starting a line number 'n'
X.LI "stevie +/pat file"
XEdit file starting at pattern 'pat'
X.LE
X.P
XIf multiple files are given on the command line (using the first form),
Xthe ":n" command goes to the next file, ":N" goes backward in the list,
Xand ":rew" can be used to rewind back to the start of the file list.
X.H 1 "Set Command Options"
XThe ":set" command works as usual to set parameters. Each parameter has
Xa long and an abbreviated name, either of which may be used. Boolean
Xparameters are set as in:
X.sp
X.ti +5
Xset showmatch
X.sp
Xor cleared by:
X.sp
X.ti +5
Xset noshowmatch
X.sp
XNumeric parameters are set as in:
X.sp
X.ti +5
Xset scroll=5
X.sp
XSeveral parameters may be set with a single command:
X.sp
X.ti +5
Xset novb sm report=1
X.P
XTo see the status of all parameters use ":set all". Typing ":set" with
Xno arguments will show only those parameters that have been changed.
XThe supported parameters, their names, abbreviations, defaults,
Xand descriptions are shown below:
X.VL 12
X.LI autoindent
XShort: ai, Default: noai, Type: Boolean
X.br
XWhen in insert mode, start new lines at the same column as the prior
Xline. Unlike vi, you can backspace over the indentation.
X.LI backup
XShort: bk, Default: nobk, Type: Boolean
X.br
XLeave a backup on file writes.
X.LI errorbells
XShort: eb, Default: noeb, Type: Boolean
X.br
XRing bell when error messages are shown.
X.LI ignorecase
XShort: ic, Default: noic, Type: Boolean
X.br
XIgnore case in string searches.
X.LI lines
XShort: lines, Default: lines=25, Type: Numeric
X.br
XNumber of physical lines on the screen. The default value actually
Xdepends on the host machine, but is generally 25.
X.LI list
XShort: list, Default: nolist, Type: Boolean
X.br
XShow tabs and newlines graphically.
X.LI modelines
XShort: ml, Default: noml, Type: Boolean
X.br
XEnable processing of modelines in files.
X.LI number
XShort: nu, Default: nonu, Type: Boolean
X.br
XDisplay lines on the screen with their line numbers.
X.LI report
XShort: report, Default: report=5, Type: Numeric
X.br
XMinimum number of lines to report operations on.
X.LI return
XShort: cr, Default: cr, Type: Boolean
X.br
XEnd lines with cr-lf when writing files.
X.LI scroll
XShort: scroll, Default: scroll=12, Type: Numeric
X.br
XNumber of lines to scroll for ^D & ^U.
X.LI showmatch
XShort: sm, Default: nosm, Type: Boolean
X.br
XWhen a ), }, or ] is typed, show the matching (, {, or [ if
Xit's on the current screen by moving the cursor there briefly.
X.LI showmode
XShort: mo, Default: nomo, Type: Boolean
X.br
XShow on status line when in insert mode.
X.LI tabstop
XShort: ts, Default: ts=8, Type: Numeric
X.br
XNumber of spaces in a tab.
X.LI terse
XShort: terse, Default: noterse, Type: Boolean
X.br
XThis option is currently ignored.
XIt is provided only for compatibility with vi.
X.LI tildeop
XShort: to, Default: noto, Type: Boolean
X.br
XIf set, tilde is an operator. Otherwise, tilde acts as normal.
X.LI wrapscan
XShort: ws, Default: ws, Type: Boolean
X.br
XString searches wrap around the ends of the file.
X.LI vbell
XShort: vb, Default: vb, Type: Boolean
X.br
XUse a visual bell, if possible. (novb for audible bell)
X.LE
X.P
XThe EXINIT environment variable can be used to modify the default values
Xon startup as in:
X.sp
X.ti +5
Xsetenv EXINIT="set sm ts=4"
X.P
XThe 'backup' parameter, if set, causes the editor to retain a backup of any
Xfiles that are written. During file writes, a backup is always kept for
Xsafety until the write is completed. At that point, the 'backup' parameter
Xdetermines whether the backup file is deleted.
X.P
XIn environments (e.g. OS/2 or TOS) where lines are normally terminated by
XCR-LF, the 'return' parameter allows files to be written with only a LF
Xterminator (if the parameter is cleared).
XThis parameter is ignored on UNIX systems.
X.P
XThe 'lines' parameter tells the editor how many lines there are on the screen.
XThis is useful on systems like the ST (or OS/2 machines with an EGA adapter)
Xwhere various screen resolutions may be
Xused. By using the 'lines' parameter, different screen sizes can be easily
Xhandled.
X.H 1 "Colon Commands"
XSeveral of the normal 'vi' colon commands are supported by STEVIE.
XSome commands may be preceded by a
Xline range specification.
XFor commands that accept a range of lines,
Xthe following address forms are supported:
X.DS 1
Xaddr
Xaddr + number
Xaddr - number
X.DE
Xwhere 'addr' may be one of the following:
X.DS 1
Xa line number
Xa mark (as in 'a or 'b)
X\'.' (the current line)
X\'$' (the last line)
X.DE
X.P
XAn address range of "%" is accepted as an abbreviation of "1,$".
X.H 2 "Mode Lines"
XMode lines are a little-known, but often useful, feature of vi.
XTo use this feature, special strings are placed in the first or
Xlast five lines in a file.
XWhen the file is edited, these strings are detected and processed
Xas though typed as a colon command.
XOne instance where this can be useful is to set the "tabstop"
Xparameter on a per-file basis.
XThe following are examples of mode lines:
X.DS 1
Xvi:set ts=4 noai:
Xex:45:
X.DE
X.P
XMode lines are characterized by the string "vi" or "ex" followed
Xby a command surrounded by colons. Other text may appear on the
Xline, and multiple mode lines may be present. No guarantee is
Xmade regarding the order in which multiple mode lines will be
Xprocessed.
X.P
XThe processing of mode lines is enabled by setting the "ml"
Xparameter. This should be done in the "EXINIT" environment
Xvariable, so that mode line processing is enabled as soon
Xas the editor begins.
XBy default, mode lines are disabled for security reasons.
X.H 2 "The Global Command"
XA limited form of the global command is supported, accepting the
Xfollowing command form:
X.DS 1
Xg/pattern/X
X.DE
Xwhere X may be either 'd' or 'p' to delete or print lines that match
Xthe given pattern.
XIf a line range is given, only those lines are checked for a match
Xwith the pattern.
XIf no range is given, all lines are checked.
X.P
XIf the trailing command character is omitted, 'p' is assumed.
XIn this case, the trailing slash is also optional.
XThe current version of the editor does not support the undo operation
Xfollowing the deletion of lines with the global command.
X.H 2 "The Substitute Command"
XThe substitute command provides a powerful mechanism for making more
Xcomplex substitutions than can be done directly from visual mode.
XThe general form of the command is:
X.DS 1
Xs/pattern/replacement/g
X.DE
XEach line in the given range (or the current line, if no range was
Xgiven) is scanned for the given regular expression.
XWhen found, the string that matched the pattern is replaced with
Xthe given replacement string.
XIf the replacement string is null, each matching pattern string is
Xdeleted.
X.P
XThe trailing 'g' is optional and, if present, indicates that multiple
Xoccurrences of 'pattern' on a line should all be replaced.
X.P
XSome special sequences are recognized in the replacement string. The
Xampersand character is replaced by the entire pattern that was matched.
XFor example, the following command could be used to put all occurrences
Xof 'foo' or 'bar' within double quotes:
X.DS 1
X1,$s/foo|bar/"&"/g
X.DE
X.P
XThe special sequence "\\n" where 'n' is a digit from 1 to 9, is replaced
Xby the string the matched the corresponding parenthesized expression in
Xthe pattern. The following command could be used to swap the first two
Xparameters in calls to the C function "foo":
X.DS 1
X1,$s/foo\\\\(([^,]*),([^,]*),/foo(\\\\2,\\\\1,/g
X.DE
X.P
XLike the global command, substitutions can't be undone with this
Xversion of the editor.
X.H 2 "File Manipulation Commands"
XThe following table shows the supported file manipulation commands as
Xwell as some other 'ex' commands that aren't described elsewhere:
X.DS
X:w		write the current file
X:wq		write and quit
X:x		write (if necessary) and quit
XZZ		same as ":x"
X
X:e file		edit the named file
X:e!		re-edit the current file, discarding changes
X:e #		edit the alternate file
X
X:w file		write the buffer to the named file
X:x,yw file	write lines x through y to the named file
X:r file		read the named file into the buffer
X
X:n		edit the next file
X:N		edit the previous file
X:rew		rewind the file list
X
X:f		show the current file name
X:f name		change the current file name
X:x=		show the line number of address 'x'
X
X:ta tag		go to the named tag
X^]		like ":ta" using the current word as the tag
X
X:help		display a command summary
X:ve		show the version number
X
X:sh		run an interactive shell
X:!cmd		run a command
X.DE
X.P
XThe ":help" command can also be invoked with the <HELP> key on the Atari
XST. This actually displays a pretty complete summary of the real vi with
Xunsupported features indicated appropriately.
X.P
XThe commands above work pretty much like they do in 'vi'. Most of the
Xcommands support a '!' suffix (if appropriate) to discard any pending
Xchanges.
X.H 1 "String Searches"
XString searches are supported, as in vi, accepting the usual regular
Xexpression syntax. This was done using a modified form of
XHenry Spencer's regular expression
Xlibrary. I added code outside the library to support
Xthe '\\<' and '\\>' extensions.
XThe parameter "ignorecase" can be set to ignore case in all string searches.
X.H 1 "Operators"
XThe vi operators (d, c, y, !, <, and >) work as true operators.
XThe tilde command may also be used as an operator if the parameter "tildeop"
Xhas been set. By default, this parameter is not set.
X.H 1 "Tags"
XTags are implemented and a fairly simple version of 'ctags' is supplied
Xwith the editor. The current version of ctags will find functions and
Xmacros following a specific (but common) form.  See 'ctags.doc' for a
Xcomplete discussion.
X.H 1 "System-Specific Comments"
XThe following sections provide additional relevant information for the
Xsystems to which STEVIE has been ported.
X.H 2 "Atari ST"
X.H 3 "TOS"
XThe editor has been tested in all three resolutions, although low and
Xhigh res. are less tested than medium. The 50-line high res. mode can
Xbe used by setting the 'lines' parameter to 50. Alternatively, the
Xenvironment variable 'LINES' can be set. The editor doesn't actively
Xset the number of lines on the screen. It just operates using the number
Xof lines it was told.
X.P
XThe arrow keys, as well as the <INSERT>, <HELP>, and <UNDO> keys are
Xall mapped appropriately.
X.H 3 "Minix"
XThe editor is pretty much the same under Minix, but many of the
Xkeyboard mappings aren't yet supported.
X.H 2 "UNIX"
XThe editor has been ported to UNIX System V release 3 as well as 4.2 BSD.
XThis was done
Xmainly to get some profiling data so I haven't put much effort into
Xdoing the UNIX version right.
XWhile the termcap routines are supported, the editor is still fairly
Xpicky about the capabilities it wants and makes little effort to
Xdo clever things with less intelligent terminals.
X.H 2 "OS/2"
XThis port was done because the editor that comes with the OS/2 developer's
Xkit really stinks. Make sure 'ansi' mode is on (using the 'ansi' command).
XThe OS/2 console driver doesn't support insert/delete line, so STEVIE
Xbypasses the driver and makes the appropriate system calls directly.
XThis is all done in the system-specific part of the editor so the kludge
Xis at least localized.
X.P
XThe arrow keys, page up/down and home/end all do what
Xyou'd expect. The function keys are hard-coded to some useful macros until
XI can get true support for macros into the editor. The current mappings
Xare:
X.DS 1
XF1	:N <RETURN>
XF2	:n <RETURN>
XF3	:e # <RETURN>
XF4	:rew <RETURN>
XF5	[[
XF6	]]
XF7	Convert C declaration to pseudo-english (uses cdecl)
XF8	Convert english-style declaration to C (uses cdecl)
XF9	:x <RETURN>
XF10	:help <RETURN>
X
XS-F1	:N! <RETURN>
XS-F2	:n! <RETURN>
X.DE
X.P
XThe macros for F7 and F8 assume that the "cdecl" program is available.
X.H 2 "MSDOS"
XSTEVIE has been ported to MSDOS 3.3 using the Microsoft
XC compiler, version 5.1.
XThe keyboard mappings are the same as for OS/2.
XThe only problem with the PC version is that the inefficiency of
Xthe screen update code becomes painfully apparent on slower machines.
X.P
XThe DOS version requires the use of an extended console driver
Xthat can insert and delete lines.
XThe distributed code uses "nansi.sys" which seems to be widely
Xavailable.
X.H 1 "Missing Features"
X.AL
X.LI
XThe ability to edit files larger than the available memory.
XThis isn't a problem on the machines I use, but it hits the
XMinix-PC people pretty hard.
X.LI
XMacros with support for function keys.
X.LI
XMore "set" options.
X.LI
XMany others...
X.LE
X.H 1 "Known Bugs and Problems"
X.AL
X.LI
XThe yank buffer uses statically allocated memory, so large yanks
Xwill fail. If a delete spans an area larger than the yank buffer,
Xthe program asks
Xfor confirmation before proceeding. That way, if you were moving text,
Xyou don't get screwed by the limited yank buffer. You just have to move
Xsmaller chunks at a time. All the internal buffers (yank, redo, etc.)
Xneed to be reworked to allocate memory dynamically. The 'undo' buffer
Xis now dynamically allocated, so any change can be undone.
X.LI
XIf you stay in insert mode for a long time, the insert buffer can overflow.
XThe editor will print a message and dump you back into command mode.
X.LI
XThe current version of the substitute and global commands
X(i.e. ":s/foo/bar" or ":g/foo/d") can't
Xbe undone.
XThis is due to the current design of the undo code.
XTo undo these
Xcommands would generally involve unreasonable amounts of memory.
X.LI
XSeveral other less bothersome glitches...
X.LE
X.SK
X.H 1 "Conclusion"
XThe editor has reached a pretty stable state, and performs well on
Xthe systems I use it on, so I'm pretty much in maintenance mode now.
XThere's still plenty to be done; the screen update code is still pretty
Xinefficient and the yank/put code is still primitive.
XI'm still interested in bug reports, and I do still add a new feature
Xfrom time to time, but the rate of change is way down now.
X.P
XI'd like to thank Tim Thompson for writing the original version of the
Xeditor. His program was well structured and quite readable. Thanks for
Xgiving me a good base to work with.
XThanks also to many users of STEVIE who have sent in their changes.
XMany of the changes I've received aren't portable to all the systems
XI support, but I'm working to get portable implementations integrated
Xinto the editor where possible.
X.P
XIf you're reading this file, but didn't get the source code for STEVIE,
Xit can be had by sending a disk with return postage to the address given
Xbelow. I can write disks for the Atari ST (SS or DS) or MSDOS (360K or
X1.2M). Please be sure to include the return postage. I don't intend to
Xmake money from this program, but I don't want to lose any either.
X.DS 1
XTony Andrews		UUCP: onecom!wldrdg!tony
X5902E Gunbarrel Ave.
XBoulder, CO 80301
X.DE
X.SK
X.HU "Character Function Summary"
XThe following list describes the meaning of each character that's used
Xby the editor. In some cases characters have meaning in both command and
Xinsert mode; these are all described.
X.SP 2
X.VL 8
X.LI ^@
XThe null character. Not used in any mode. This character may not
Xbe present in the file, as is the case with vi.
X.LI ^B
XBackward one screen.
X.LI ^D
XScroll the window down one half screen.
X.LI ^E
XScroll the screen up one line.
X.LI ^F
XForward one screen.
X.LI ^G
XSame as ":f" command. Displays file information.
X.LI ^H
X(Backspace) Moves cursor left one space in command mode.
XIn insert mode, erases the last character typed.
X.LI ^J
XMove the cursor down one line.
X.LI ^L
XClear and redraw the screen.
X.LI ^M
X(Carriage return) Move to the first non-white character
Xin the next line. In insert mode, a carriage return opens a new
Xline for input.
X.LI ^N
XMove the cursor down a line.
X.LI ^P
XMove the cursor up a line.
X.LI ^U
XScroll the window up one half screen.
X.LI ^Y
XScroll the screen down one line.
X.LI ^[
XEscape cancels a pending command in command mode, and is used to
Xterminate insert mode.
X.LI ^]
XMoves to the tag whose name is given by the word in which the cursor
Xresides.
X.LI ^`
XSame as ":e #" if supported (system-dependent).
X.LI SPACE
XMove the cursor right on column.
X.LI !
XThe filter operator always operates on a range of lines, passing the
Xlines as input to a program, and replacing them with the output of the
Xprogram. The shorthand command "!!" can be used to filter a number of
Xlines (specified by a preceding count). The command "!" is replaced
Xby the last command used, so "!!!<RETURN>" runs the given number of
Xlines through the last specified command.
X.LI $
XMove to the end of the current line.
X.LI %
XIf the cursor rests on a paren '()', brace '{}', or bracket '[]',
Xmove to the matching one.
X.LI \'
XUsed to move the cursor to a previously marked position, as
Xin 'a or 'b. The cursor moves to the start of the marked line. The
Xspecial mark '' refers to the "previous context".
X.LI +
XSame as carriage return, in command mode.
X.LI ,
XReverse of the last t, T, f, or F command.
X.LI -
XMove to the first non-white character in the previous line.
X.LI .
XRepeat the last edit command.
X.LI /
XStart of a forward string search command. String searches may be
Xoptionally terminated with a closing slash. To search for a slash
Xuse '\\/' in the search string.
X.LI 0
XMove to the start of the current line. Also used within counts.
X.LI 1-9
XUsed to add 'count' prefixes to commands.
X.LI :
XPrefix character for "ex" commands.
X.LI ;
XRepeat last t, T, f, or F command.
X.LI <
XThe 'left shift' operator.
X.LI >
XThe 'right shift' operator.
X.LI ?
XSame as '/', but search backward.
X.LI A
XAppend at the end of the current line.
X.LI B
XBackward one blank-delimited word.
X.LI C
XChange the rest of the current line.
X.LI D
XDelete the rest of the current line.
X.LI E
XEnd of the end of a blank-delimited word.
X.LI F
XFind a character backward on the current line.
X.LI G
XGo to the given line number (end of file, by default).
X.LI H
XMove to the first non-white char. on the top screen line.
X.LI I
XInsert before the first non-white char. on the current line.
X.LI J
XJoin two lines.
X.LI L
XMove to the first non-white char. on the bottom screen line.
X.LI M
XMove to the first non-white char. on the middle screen line.
X.LI N
XReverse the last string search.
X.LI O
XOpen a new line above the current line, and start inserting.
X.LI P
XPut the yank/delete buffer before the current cursor position.
X.LI R
XReplace characters until an "escape" character is received.
XSimilar to insert mode, but replaces instead of inserting.
XTyping a newline in replace mode is the same as in insert mode,
Xbut replacing continues on the new line.
X.LI T
XReverse search 'upto' the given character.
X.LI U
XRestore the current line to its state before you started changing it.
X.LI W
XMove forward one blank-delimited word.
X.LI X
XDelete one character before the cursor.
X.LI Y
XYank the current line. Same as 'yy'.
X.LI ZZ
XExit from the editor, saving changes if necessary.
X.LI [[
XMove backward one C function.
X.LI ]]
XMove forward one C function.
X.LI ^
XMove to the first non-white on the current line.
X.LI `
XMove to the given mark, as with '. The distinction between the two
Xcommands is important when used with operators. I support the
Xdifference correctly. If you don't know what I'm talking about,
Xdon't worry, it won't matter to you.
X.LI a
XAppend text after the cursor.
X.LI b
XBack one word.
X.LI c
XThe change operator.
X.LI d
XThe delete operator.
X.LI e
XMove to the end of a word.
X.LI f
XFind a character on the current line.
X.LI h
XMove left one column.
X.LI i
XInsert text before the cursor.
X.LI j
XMove down one line.
X.LI k
XMove up one line.
X.LI l
XMove right one column.
X.LI m
XSet a mark at the current position (e.g. ma or mb).
X.LI n
XRepeat the last string search.
X.LI o
XOpen a new line and start inserting text.
X.LI p
XPut the yank/delete buffer after the cursor.
X.LI r
XReplace a character.
X.LI s
XReplace characters.
X.LI t
XMove forward 'upto' the given character on the current line.
X.LI u
XUndo the last edit.
X.LI w
XMove forward one word.
X.LI x
XDelete the character under the cursor.
X.LI y
XThe yank operator.
X.LI z
XRedraw the screen with the current line at the top (zRETURN),
Xthe middle (z.), or the bottom (z-).
X.LI |
XMove to the column given by the preceding count.
X.LI ~
XInvert the case of the current character (if alpha) and move to the right.
XIf the parameter "tildeop" is set, this command functions as an operator.
X.LE
X.de TX
X.ce
XSTEVIE - User Guide
X.sp
X..
X.TC
HE_HATES_THESE_CANS
if test 22796 -ne "`wc -c < 'stevie.mm'`"
then
	echo shar: error transmitting "'stevie.mm'" '(should have been 22796 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
--