Skip to content

mbert/elvis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<html><head>
<title>README.html file for elvis 2.1</title>
<meta name="description" content="Quick intro to elvis 2.1, with links to source code and binaries">
<meta name="keywords" content="vi, elvis, unix, linux, msdos, win32, windows95 windowsNT, nt, os2, os/2, editor, source">
</head><body>

<center>
<h1>Quick intro to elvis 2.1, with links to source code and binaries</h1>
</center>

<strong>CONTENTS</strong>
<menu>
<li><a HREF="#thisfile">1. About this file</a>
<li><a HREF="#vi">2. Differences between vi and elvis 2.1</a>
<li><a HREF="#new">3. Differences between 2.0 and 2.1</a>
	<menu>
	<li><a HREF="#ex">3.1 New ex commands</a>
	<li><a HREF="#options">3.2 New options commands</a>
	<li><a HREF="#functions">3.3 New functions</a>
	<li><a HREF="#gui">3.4 New ports and GUI features</a>
	<li><a HREF="#misc">3.5 Miscellany</a>
	</menu>
<li><a HREF="#future">3. The future of elvis</a>
<li><a HREF="#links">4. Links to related files</a>
</menu>

<hr>
<h1><a NAME="thisfile"></a>1. About this file</h1>

This file is written in the HTML markup language.
You can view it with any WWW viewer, such as Netscape.
You can also use elvis 2.1i-beta to view it; this version of elvis
has the ability to view HTML documents, and print them.

<p>This file has many hypertext links.
Use them!
If you're using elvis 2.1 to browse this file, then hypertextual
references will appear as underlined text.
(Except on color PCs;
since color video cards don't support underlining,
hypertextual references will be colored -- white on red, by default.)
To follow the hypertext link, move the cursor onto the underlined
text and press (Enter).
To go back, press (Control-T).
The (Tab) key moves the cursor forward to the next hypertext reference.

<p>If elvis 2.1 doesn't automatically start up in HTML mode when you view this file,
then you'll need to force it into HTML mode by giving the command
"<code>:display html</code>".

<h1><a name="vi"></a>2. Differences between vi and elvis 2.1</h1>
Elvis is a superset of vi.
It runs on more operating systems than vi,
it is free,
and you can obtain the source code.
Elvis also has many new features.
These new features are described in the first chapter of the online manual,
which hypertext links to the other parts of the manual where those features
are described in detail.
Here's a just brief list:

<p>
<ul>

<li>Multiple edit buffers, so you can edit several files at once.
<li>Multiple windows, so you can see multiple edit buffers, or different
	parts of the same edit buffer.
<li>Multiple user interfaces, including graphical interfaces under
	Windows95/98/NT and X11.
<li>A variety of display modes, including syntax coloring and HTML.
<li>Online help, with hypertext links.
<li>Enhanced tags, to support overloading in C++.
<li>Network support, so you can load/save files via FTP, or even use elvis 		as a light-weight Web browser.
<li>Aliases, which allow you to define new ex commands.
<li>Built-in calculator

</ul>

<h1><a name="new"></a>3. Differences between 2.0 and 2.1</h1>

The following is a summary of changes made since the release of elvis 2.0.
These are in addition to bug changes.

<h2>3.1 <a name="ex">New ex commands</a></h2>
<dl>

<dt>:only
<dd>This closes all windows except the current window.
<pre>
	:only
</pre>

<dt>:browse
<br>:sbrowse
<dd>These build a list of all tags which match given criteria (e.g., all tags
in a particular file), and make an HTML document with links to all the
definition points in your source code.
The <code>:browse</code> command saves the cursor position on the stack and
then displays the table in the current window.
The <code>:sbrowse</code> command creates a new window showing that table.
<pre>
	:browse foo.c
	:sbrowse class:/Ball
</pre>

<dt>:bbrowse
<br>:sbbrowse
<dd>These build an HTML document with links to all the edit buffers.
The <code>:bbrowse</code> command saves the cursor position on the stack and
then displays the table in the current window.
The <code>:sbbrowse</code> command creates a new window showing that table.
<pre>
	:bbrowse
</pre>

<dt>:alias
<br>:unalias
<dd>The <code>:alias</code> command creates an alias -- a new ex command which
you can implement via a series of existing ex commands.
Aliases can accept arguments, and perform complex operations.
Many sample aliases are included in the distribution.
<pre>
	:alias lower !% s/.*/\L&amp;/
</pre>

<dt>:message
<br>:warning
<br>:error
<dd>These output messages of various types.
In particular, the <code>:error</code> message type has the side-effect of
aborting any pending macros or aliases.
<pre>
	:if !&lt; == !&gt;
	:then error Address range required
</pre>

<dt>:local
<dd>This is handy in aliases.
It is like <code>:set</code>, except that the options will be restored
to their previous value when the alias exits.
<pre>
	:alias total {
		"Sum the integers in a range of lines
		local t=0 report=0 nosaveregexp
		!% s/[0-9]\+/let t=t+\1/x
		eval !% c (t)
	}
</pre>

<dt>:try
<dd>This executes a command, and then checks the success/failure indicator
returned by that command.
The then/else flag is set accordingly.
Regardless of whether the command succeeded or not, <code>:try</code> itself
always succeeds;
this is significant because when a command fails
(anywhere except as the argument of a <code>:try</code> command),
any pending macros or aliases are aborted.
<pre>
	:alias togglecase {
		try !% s/.*/\U&amp;
		else !% s/.*/\L&amp;
	}
</pre>

<dt>:while
<br>:do
<dd>This executes a command in a loop, as long as a given condition holds true.
<pre>
	:let i = 1
	:while i &lt;= 10
	:do {
		calc i
		let i = i + 1
	}
</pre>

</dl>

<h2><a name="options">3.2 Options</a></h2>
Many new options have been added.
Some exist only in a particular user interface, though.
These are all described below.

<dl>

<dt>bufid, bufferid
<dd>Each user buffer is automatically assigned a numeric identifier,
which is stored in this option.
These can be used later as a shorthand for either the buffer's filename or
buffername.
<pre>
	:e #1
	:1,20 cop (1)$
</pre>

<dt>locked, lock
<dd>When set, this option prevents any changes from being made to the buffer.
This is a slightly stronger version of the "readonly" option.

<dt>readeol, reol
<br>writeeol, weol
<dd>Together, these two options replace the old "binary" option.
<code>readeol</code> can be set to one of <strong>dos</strong>,
<strong>unix</strong>, <strong>mac</strong>, <strong>text</strong>, or
<strong>binary</strong> to indicate the newline translations that were
used to read a file into a buffer.
The <code>writeeol</code> option can be set to any of those values, or
the special value <strong>same</strong> to use the same translation as
each buffer was read with.

<dt>partiallastline, pll
<dd>Traditionally, when vi is invoked on a file which doesn't end with a
newline, vi adds one.
Elvis does that too now, but since elvis can also be used on binary files
it needs to remember whether it has added a newline, so it can omit that
bogus newline when doing a binary write.
That's what this option is for.

<dt>putstyle, ps
<dd>This is only meaningful for cut buffers, not normal edit buffers.
It indicates whether the cutr buffer's contents should be pasted as
a series of characters, as a rectangular block, or as whole lines.
(Previously this information was stored in the first line of a cut buffer,
but that made cut buffers hard to edit.)

<dt>matchchar, mc
<dd>The visual <code>%</code> command has been extended to match any
pairs of characers.
This option stores the list of character pairs.

<dt>completebinary, cob
<dd>Elvis performs file name completion -- you can type a partial file name
and hit &lt;Tab&gt; to have elvis complete the name for you (or as much of
the name as possible before ambiguities are encountered).
Normally elvis ignores binary files when looking for possible completions;
it only considers the names of text files.
Setting this option makes it check the names of binary files as well as
text files.

<dt>showname, snm
<br>showtag, st
<dd>These cause elvis to display extra information at the bottom of the
window, whenever it has nothing better to show there.
<code>showname</code> causes it to display the name of the current file.
<code>showtag</code> causes it to display the name of the tag which is
defined on the current line, or the nearest line above it which has a tag.
The <code>showtag</code> option can make elvis take more time to load files,
since it must find the location of every tag for that file.

<dt>true, True
<br>false, False
<dd>These options mostly exist so you can use the symbols <code>true</code>
and <code>false</code> in the expressions used by <code>:if</code> and the like.
The value of the <code>false</code> option is used as a logical false value,
just like "", "0", or "false"; anything else is considered to be a logical
true value.

<p>Any boolean option returns the value of the <code>true</code> option if it
is set, or the <code>false</code> option if it is reset.
Non-english speakers may wish to set <code>true</code> and <code>false</code>
to the local words for those logical states.
You can do that by setting those options explicitly, or by adding lines to
the "elvis.msg" file (e.g., "true:verdad" and "false:falso").

<dt>submit, Submit
<br>cancel, Cancel
<br>help, Help
<dd>The "x11" user interface uses these like the <code>true</code> and
<code>false</code> options, to translate a few words that it uses.
Actually, <code>help</code> doesn't do anything yet, but the values of
<code>submit</code> and <code>cancel</code> are used as the labels of
buttons on dialog windows.

<dt>scrollbar, sb
<br>toolbar, tb
<br>statusbar, stb
<br>menubar, mb
<dd>These enable or disable certain parts of the a GUI window.
They are supported by the "windows" GUI (for Windows95/98/NT) and the
"x11" GUI (for Unix).
Actually <code>menubar</code> isn't support by "x11" because "x11" doesn't
have a menu bar yet.

<dt>font, fnt
<br>normalstyle, nfn
<br>boldstyle, bfn
<br>italicstyle, ifn
<br>fixedstyle, ffn
<br>emphasizedstyle, efn
<br>underlinedstyle, nfn
<dd>These control the appearance of text in the "windows" interface (for
Windows95/98/NT).
<code>font</code> stores the base font, and the other options tell elvis
how to derive a display font from the base font.

<dt>underline, uln
<br>scrollbarleft, xsl
<br>borderwidth, xbw
<br>textcursor, tc
<br>outlinemono, om
<dd>These are all "x11" options.

<dt>saveregexp, sre
<dd>Many scripts and aliases reset this.
Normally when you perform a search or substitution, elvis remembers
the regular expression you used so you can perform the same search/substitution
again later without retyping the whole regular expression.
That's handy.
But many aliases and scripts perform their own internal searches and
substitutions, and those shouldn't cause elvis to forget the your
regular expression.
So aliases often do <code>:local nosre</code> to protect your regular
expression.

<dt>tagprg, tp
<br>tagprgonce, tpo
<dd>These allow you to use an external program to perform tag searches.

<dt>blkhit, bh
<br>blkmiss, bm
<br>blkwrite, bw
<dd>These provide extra information about elvis' internal block cache.

<dt>program, argv0
<dd>This stores the name by which elvis was invoked.
The default "elvis.ini" file uses this information to distinguish between
"ex" behavior and "view" behavior from the normal "vi" behavior.

<dt>lpnumber, lpn
<br>lpheader, lph
<dd>These affect the way text is printed.
Setting <code>lpnumber</code> causes line numbers to be printed, just as
<code>number</code> causes line number to be shown on the screen.
For the "normal" or "syntax" display modes, <code>lpheader</code>
causes pages to have a header showing the file name, page number, and date.

<dt>previousdir, pdir
<dd>This stores the previous directory.
You can use "~-" (tilde minus) at the start of a file name as a shorthand
for the previous directory name.

</dl>

<h2><a name="functions">3.3 New functions</a></h2>
The following functions have been added to the built-in calculator.
This is used by <code>:if</code>, <code>:let</code>, and others.

<dl>

<dt>htmlsafe(<var>string</var>)
<dd>This replaces the &amp;, &lt;, &gt;, and &quot; characters with
<strong>&amp;amp;</strong>,
<strong>&amp;lt;</strong>,
<strong>&amp;gt;</strong>, and
<strong>&amp;quot;</strong>, respectively.

<dt>quote(<var>chars</var>, <var>str</var>)
<br>unquote(<var>chars</var>, <var>str</var>)
<dd>These add or remove backslashes.
<code>quote()</code> adds a backslash before each existing backslash, and
before each character listed in the <var>chars</var> string.
<code>unquote()</code> does the opposite.

<dt>current(<var>what</var>)
<dd>This examines elvis' internal variables.
It can be any of the following:
<pre>
	<strong>line</strong>	cursor's current line number
	<strong>column</strong>	cursor's current column number
	<strong>word</strong>	word at the cursor position
	<strong>mode</strong>	mode name as reported by showmode option
	<strong>next</strong>	next file in args list
	<strong>prev</strong>	previous file in args list
	<strong>tag</strong>	current tag as reported by showtag option
</pre>

<dt>fileeol(<var>file</var>)
<dd>Examine the contents of a file, and make a guess about what value
the <code>readeol</code> option should be set to.

<dt>getcwd()
<dd>Return the name of the current directory.

<dt>absolute(<var>file</var>)
<dd>Return the fully-specified name of a given file.
In other words, if it is in the current directory then combine the current
directory name with the file name.

<dt>alias(<var>name</var>)
<dd>Test for the existence of a given alias.

</dl>

<h2><a name="gui">3.4 New ports, and new GUI features</a></h2>
<dl>

<dt>Graphical Win32 port
<dd>In addition to a text-mode version, there is now a fully graphical version
of elvis for Windows95/98/NT, named WinElvis.
It is included in the Win32 binary distribution.

<dt>OS/2 port
<dd>A text-mode port of elvis for OS/2 has been completed.

<dt>X11 improvements
<dd>The "x11" user interface has been improved through the addition of a
status bar and a configurable tool bar.
Tool bar buttons can even have configurable dialog windows.

</dl>

<h2><a name="misc">3.5 Miscellany</a></h2>

<dl>

<dt>Name completion
<dd>The &lt;Tab&gt; key is used for name completion on ex command lines.
It can complete file names, ex command names, option names, and tag names.
You can also make it perform tag name completion in your own files by
running "<code>:set&nbsp;inputtab=identifier</code>".

<dt>Tilde in a file name
<dd>Elvis 2.0 allowed you to use "~" at the start of a file name to access
files in your home directory.
2.1 adds the ability to use "~+" for the current directory's absolute path name,
and "~-" for the previous directory.
Also, under Unix you can use "~<var>user</var>" for the home directory of
<var>user</var>.
~name, ~+, ~-

<dt>Network protocols
<dd>Elvis can read via HTTP, and read or write via FTP.
Just use a Web URL in place of a file name, like this:
<pre>
	:e ftp://ftp.cs.pdx.edu/pub/elvis/README.html</pre>
<p>Together with elvis' "html" display mode, this allows elvis to be used
as a light-weight Web browser.

<dt>"tex" display mode
<dd>A "tex" display mode has been implemented.
It handles the simplest TeX documents moderately well.
Unlike real TeX formatters, though, elvis' "tex" mode is not programmable
so it doesn't handle custom commands.

<dt>Enhanced tags
<dd>Elvis' tags implementation has been enhanced to support overloaded tags
as required for C++.
There is a whole chapter in the manual describing all the wonderful things
you can do with tags now.

<dt>Multi-line ex clauses
<dd>Some ex commands accept another ex command as an argument.
The <code>:g</code> command is an example of this.
Traditionally, vi has allowed multiple commands by placing a backslash before
the end of each line except the last, but this didn't always work.
Elvis supports that, and adds a better alternative:
If you give a '{' in place of the command, then elvis will read the following
lines up to the next matching '}', and use the intervening lines as the ex
command.
This is both more reliable and more readable than the backslash notation.

<dt>Confirming substitutions
<dd>Elvis 2.0's implementation of the <code>:s///</code> command lacked
support for the <code>c</code> flag.
Elvis 2.1 supports <code>:s///c</code>, at long last!

</dl>

<h1><a name="future"></a>3. The future of elvis</h1>

One of the biggest tasks on my list is to rewrite the ctags program
so that it will be able to parse C++ code better.
It should read the language descriptions from "elvis.syn", and do at least
a half-assed job of generating tags for any language described there.
I'm also toying with the idea of a statistical tags generator, but that's
still pretty nebulous at this point.

<p>Windowing will be more versatile.
Currently the GUI versions of elvis always split detached windows;
sometimes it would be nice if they could be attached to the existing window,
as a horizontal or vertical pane.

<p>I intend to add a true extension language to elvis someday, but it
isn't in 2.1.
The language interface will be general enough to support a variety of
languages.  The first language supported will probably be PERL, followed
rapidly by Python and TCL.

<h1><a name="links"></a>4. Links to related files</H1>

If the main site (<a href="ftp://ftp.cs.pdx.edu/pub/elvis/README.html">ftp.cs.pdx.edu</a>) is too slow, try the mirror site at
<a href="ftp://ftp.false.com/pub/elvis/README.html">
ftp.false.com</a>.

<p>Most of the following are binary files, not text or HTML files,
so you can't view then with your Web browser.
But you can use your browser to download the files.
For Netscape, use &lt;Shift-Click&gt;;
for MSIE, use &lt;RightClick&gt; and "download".

<dl>

<dt><a href="/pub/elvis/untar.c">untar.c</a>
<dd>This is the complete source code for "untar",
a little program which extracts files from a gzipped tar archive.
Comments near the top of "untar.c" describe how to compile and use it.
If you already have the gzip and tar utilities, then you don't need this.

<dt><a href="ftp://ftp.cs.pdx.edu/pub/elvis/untardos.exe">untardos.exe</a>
<dd>This is an MS-DOS executable, produced from the above "untar.c" file.
It can also be run under Windows 3.1, in a Dos-prompt window.
For brief instructions on how to use <code>untardos,</code>
run it with no arguments.

<dt><a href="ftp://ftp.cs.pdx.edu/pub/elvis/untarw32.exe">untarw32.exe</a>
<dd>This is a Win32 executable, produced from the above "untar.c" file.
It runs under WindowsNT and Windows95.
It runs somewhat faster than the MS-DOS version.
It also supports long file names.
For brief instructions on how to use <code>untarw32,</code>
run it with no arguments, in a text-mode window.

<p><strong>NOTE:</strong>
MS-Windows95 and MS-DOS use incompatible methods for mapping long file names
to short ones.
So if you extract the files under Windows95, DOS programs won't be able to
find them with their expected names, and vice versa.
Consequently, you must use <code>untardos.exe</code> to unpack
<code>elvis-2.1-msdos.tar.gz</code>, and <code>untarw32.exe</code> to unpack
<code>elvis-2.1-win32.tar.gz</code>.

<dt><a href="ftp://ftp.cs.pdx.edu/pub/elvis/untaros2.exe">untaros2.exe</a>
<dd>This is an OS/2 executable, produced from the above "untar.c" file.
For brief instructions on how to use <code>untaros2,</code>
run it with no arguments.

<dt><a href="elvis-2.1.tar.gz">elvis-2.1.tar.gz</a>
<dd>This is a gzipped tar archive of the source code and documentation for
Elvis 2.1 and its related programs.

<dt><a href="elvis-2.1-msdos.tar.gz">elvis-2.1-msdos.tar.gz</a>
<dd>This archive contains the documentation and MS-DOS executables
for Elvis 2.1.

<dt><a href="elvis-2.1-win32.tar.gz">elvis-2.1-win32.tar.gz</a>
<dd>This archive contains the documentation and Win32 executables
for Elvis 2.1.
These were compiled and tested under Windows95, but should work under
WindowsNT 3.51 (or later) as well.

<dt><a href="elvis-2.1-os2.tar.gz">elvis-2.1-os2.tar.gz</a>
<dd>This archive contains the documentation and OS/2 executables
for Elvis 2.1.

<dt>
<a href="ftp://ftp.fh-wedel.de/pub/fh-wedel/staff/herbert/elvis/00-index.html">
ftp://ftp.fh-wedel.de/pub/fh-wedel/staff/herbert/elvis/00-index.html</a>
<dd>This is where the OS/2 maintainer stores his most up-to-date versions.
It may be better than the <code>elvis-2.1-os2.tar.gz</code> file, above.
</dl>

</body></html>