Quick intro to elvis 2.1, with links to source code and binaries

CONTENTS
  • 1. About this file
  • 2. Differences between vi and elvis 2.1
  • 3. Differences between 2.0 and 2.1
  • 3.1 New ex commands
  • 3.2 New options commands
  • 3.3 New functions
  • 3.4 New ports and GUI features
  • 3.5 Miscellany
  • 3.6 Revisions since the original 2.1 release
  • 4. The future of elvis
  • 5. Links to related files

  • 1. About this file

    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.

    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.

    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 ":display html".

    2. Differences between vi and elvis 2.1

    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:

    3. Differences between 2.0 and 2.1

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

    3.1 New ex commands

    :only
    This closes all windows except the current window.
    	:only
    
    :browse
    :sbrowse
    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 :browse command saves the cursor position on the stack and then displays the table in the current window. The :sbrowse command creates a new window showing that table.
    	:browse foo.c
    	:sbrowse class:/Ball
    
    :bbrowse
    :sbbrowse
    These build an HTML document with links to all the edit buffers. The :bbrowse command saves the cursor position on the stack and then displays the table in the current window. The :sbbrowse command creates a new window showing that table.
    	:bbrowse
    
    :alias
    :unalias
    The :alias 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.
    	:alias lower !% s/.*/\L&/
    
    :message
    :warning
    :error
    These output messages of various types. In particular, the :error message type has the side-effect of aborting any pending macros or aliases.
    	:if !< == !>
    	:then error Address range required
    
    :local
    This is handy in aliases. It is like :set, except that the options will be restored to their previous value when the alias exits.
    	: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)
    	}
    
    :try
    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, :try itself always succeeds; this is significant because when a command fails (anywhere except as the argument of a :try command), any pending macros or aliases are aborted.
    	:alias togglecase {
    		try !% s/.*/\U&
    		else !% s/.*/\L&
    	}
    
    :while
    :do
    This executes a command in a loop, as long as a given condition holds true.
    	:let i = 1
    	:while i <= 10
    	:do {
    		calc i
    		let i = i + 1
    	}
    

    3.2 Options

    Many new options have been added. Some exist only in a particular user interface, though. These are all described below.
    bufid, bufferid
    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.
    	:e #1
    	:1,20 copy (1)$
    
    locked, lock
    When set, this option prevents any changes from being made to the buffer. This is a slightly stronger version of the "readonly" option.
    readeol, reol
    writeeol, weol
    Together, these two options replace the old "binary" option. readeol can be set to one of dos, unix, mac, text, or binary to indicate the newline translations that were used to read a file into a buffer. The writeeol option can be set to any of those values, or the special value same to use the same translation as each buffer was read with.
    partiallastline, pll
    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.
    putstyle, ps
    This is only meaningful for cut buffers, not normal edit buffers. It indicates whether the cut 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.)
    matchchar, mc
    The visual % command has been extended to match any pairs of characers. This option stores the list of character pairs.
    completebinary, cob
    Elvis performs file name completion -- you can type a partial file name and hit <Tab> 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.
    showname, snm
    showtag, st
    These cause elvis to display extra information at the bottom of the window, whenever it has nothing better to show there. showname causes it to display the name of the current file. showtag 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 showtag option can make elvis take more time to load files, since it must find the location of every tag for that file.
    true, True
    false, False
    These options mostly exist so you can use the symbols true and false in the expressions used by :if and the like. The value of the false option is used as a logical false value, just like "", "0", or "false"; anything else is considered to be a logical true value.

    Any boolean option returns the value of the true option if it is set, or the false option if it is reset. Non-english speakers may wish to set true and false 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").

    submit, Submit
    cancel, Cancel
    help, Help
    The "x11" user interface uses these like the true and false options, to translate a few words that it uses. Actually, help doesn't do anything yet, but the values of submit and cancel are used as the labels of buttons on dialog windows.
    scrollbar, sb
    toolbar, tb
    statusbar, stb
    menubar, mb
    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 menubar isn't support by "x11" because "x11" doesn't have a menu bar yet.
    font, fnt
    normalstyle, nfn
    boldstyle, bfn
    italicstyle, ifn
    fixedstyle, ffn
    emphasizedstyle, efn
    underlinedstyle, ufn
    These control the appearance of text in the "windows" interface (for Windows95/98/NT). font stores the base font, and the other options tell elvis how to derive a display font from the base font.
    underline, uln
    scrollbarleft, xsl
    borderwidth, xbw
    textcursor, tc
    outlinemono, om
    These are all "x11" options.
    saveregexp, sre
    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 :local nosre to protect your regular expression.
    tagprg, tp
    tagprgonce, tpo
    These allow you to use an external program to perform tag searches.
    blkhit, bh
    blkmiss, bm
    blkwrite, bw
    These provide extra information about elvis' internal block cache.
    program, argv0
    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.
    lpnumber, lpn
    lpheader, lph
    These affect the way text is printed. Setting lpnumber causes line numbers to be printed, just as number causes line number to be shown on the screen. For the "normal" or "syntax" display modes, lpheader causes pages to have a header showing the file name, page number, and date.
    previousdir, pdir
    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.

    3.3 New functions

    The following functions have been added to the built-in calculator. This is used by :if, :let, and others.
    htmlsafe(string)
    This replaces the &, <, >, and " characters with &amp;, &lt;, &gt;, and &quot;, respectively.
    quote(chars, str)
    unquote(chars, str)
    These add or remove backslashes. quote() adds a backslash before each existing backslash, and before each character listed in the chars string. unquote() does the opposite.
    current(what)
    This examines elvis' internal variables. It can be any of the following:
    	line	cursor's current line number
    	column	cursor's current column number
    	word	word at the cursor position
    	mode	mode name as reported by showmode option
    	next	next file in args list
    	prev	previous file in args list
    	tag	current tag as reported by showtag option
    
    fileeol(file)
    Examine the contents of a file, and make a guess about what value the readeol option should be set to.
    getcwd()
    Return the name of the current directory.
    absolute(file)
    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.
    alias(name)
    Test for the existence of a given alias.

    3.4 New ports, and new GUI features

    Graphical Win32 port
    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.
    OS/2 port
    A text-mode port of elvis for OS/2 has been completed.
    X11 improvements
    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.

    3.5 Miscellany

    Name completion
    The <Tab> 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 ":set inputtab=identifier".
    Tilde in a file name
    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 "~user" for the home directory of user. ~name, ~+, ~-
    Network protocols
    Elvis can read via HTTP, and read or write via FTP. Just use a Web URL in place of a file name, like this:
    	:e ftp://ftp.cs.pdx.edu/pub/elvis/README.html

    Together with elvis' "html" display mode, this allows elvis to be used as a light-weight Web browser.

    "tex" display mode
    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.
    Enhanced tags
    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.
    Multi-line ex clauses
    Some ex commands accept another ex command as an argument. The :g 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.
    Confirming substitutions
    Elvis 2.0's implementation of the :s/// command lacked support for the c flag. Elvis 2.1 supports :s///c, at long last!

    3.6 Revisions since the first 2.1 release

    This version of elvis is 2.1_3 (pronounced "two point one patch-level 3"). It may also be written as 2.1.3; however, the "2.1_3" notation was chosen for a reason: the directory name "elvis-2.1_3" is a valid MS-DOS directory name, but "elvis-2.1.3" is not.

    Many bugs and annoyances have been fixed since the first 2.1 release a couple months ago. The highlights are:

    Portability
    The "configure" script has been tweaked to support some Unix variants better. In particular, you should now be able to compile elvis under Linux systems that use libc-6, such as Red Hat, without doing anything except "configure;make". The same goes for SCO Unix.

    Elvis' version of ctags will now be installed as "elvtags" on all Unix systems, including Linux. Previously for Linux it was installed as "ctags", which made sense because originally most versions of Linux used elvis 1.8's "ctags", but now most Linux systems ship with Exuberant Ctags as their default ctags. Previously, other versions of Unix skipped elvis' ctags because they already had their own. The new name for elvis' ctags should allow you to keep the old ctags and still have access to elvis' ctags when you want it. (Elvis' version can generate the "ln" attribute, which makes the showtag option load files faster, but Exuberant Ctags is better in just about every other way.)

    Elvis' "fmt" program is no longer included in the default program list for any version of Unix. Previously it was installed under Linux, and skipped for other versions of Unix.

    Vi commands
    The [[ and ]] commands were acting like line-mode commands; i.e., even with the cursor in the middle of a line, an operator such as d]] would delete whole lines. The real vi doesn't behave that way, so this was a bug. It has been fixed.

    In fixing that bug, I noticed a problem in the way elvis was handling character-mode operations which happen to end at the start of a line. In certain circumstances, elvis was including the final newline character as part of the affected text, where the real vi would exclude it. This has been fixed.

    Another minor bug: After a command such as "25i*^[" (to insert 25 asterisks), attempting to repeat the command via "." would only insert 24 asterisks. This has been fixed.

    Name completion
    The behavior of name completion is now slightly different. In 2.1_3, even if you've left the completebinary option turned off, elvis will still complete binary files' names when you're entering a shell command. This is handy when you're trying to enter an ex command such as...
    	:r !uuencode elvis-2.1_3.tar.gz <elvis-2.1_3.tar.gz
    
    ... in which you're running a program which takes a binary file as input. In any other context, the completebinary option will continue to work as before.

    If you normally have inputtab=identifier set, elvis will ignore that (treat it like inputtab=tab) unless there is a "tags" file in the current directory. Without this rule, there could be a long delay if you're editing a non-source file and you hit the <Tab> key, because elvis would search through the whole tag path for the word before the tab. (A better solution is to only set inputtab=identifier if the file is in a known programming language, as detected by the knownsyntax(file) function. You can add that to your ~/.exrc file.)

    Tags (other than name completion)
    The tagprgonce option has been removed because the :local command offers a cleaner way to achieve the same effect. In any alias or script, you can simply replace ":set tagprgonce=..." with ":local tagprg=...".

    Also, there was a bug which prevented elvis from recognizing tags whose address contained a C++ comment. (In other words, "//" confused the tag file parser.) This bug is now fixed.

    Error reporting
    When there's an error in a script file or an alias, elvis 2.1_3 will now (usually) tell you the name of the script and the line number within it, where the error occurred. It only does this if the verbose option is set to 1 or higher (i.e., you give at least one uppercase -V flag on the command line).

    I added this mostly because users on some Unix platforms have reported that elvis says "# is illegal during initialization". It doesn't happen on any system I use, and none of the standard scripts contain a "#" command, so I'm hoping this will allow users to give me more information.

    Also, the :cc and :make commands used to output the first error message before the user hit <Enter>, but now it will show that message afterward.

    Networking
    The notation for FTP URLs has been extended. The original release of elvis 2.1 supported the standard ftp://host/resource notation for anonymous FTP, and elvis' own ftp://host/~/resource notation for accessing your own FTP account. Elvis 2.1_3 now adds ftp://host/~user/resource to access some other user's account.

    The format of the ~/.netrc file or elvis.ftp file remains the same, but the way elvis interprets it has changed. It now allows multiple entries for the same machine, with different user names. When you use the ftp://host/~user/resource notation to access a given user's account, elvis will search for an entry with a matching host and user, and use the password from that entry.

    Elvis' implementation of HTTP was having trouble talking to some sites that run older server software. This should be fixed now.

    Windows95/98/NT
    The font selection dialog was listing all fonts, even though elvis can only use fixed-pitch fonts correctly. This has been changed, so the dialog will now list only the fixed-pitch fonts.

    Many fixed-pitch fonts were being displayed with a large gap between the characters. For example, although "Courier" looked good, "Courier New" was unusable. This has been corrected by making elvis use the average character width instead of the maximum width. (Shouldn't those two values be the same for fixed-pitch fonts? Apparently they aren't.)

    You can now define your own colors, in addition to the named colors, by using the notation #RRGGBB anywhere a color name is expected. The "RR", "GG", and "BB" are any pairs of hex digits, giving the amount of of red, green, and blue in the color. For example, "#c0d0ff" is a nice sky-blue color. (This is the same notation that X-windows uses for non-standard colors.) Presently this feature is limited to defining one extra foreground color plus one extra background color, and it only works correctly on "high color" or "true color" displays (not 16-color or 256-color); these limitations should be lifted in later versions of elvis.

    Sometimes, for some programs, elvis was unable to redirect a program's stdin. This messed up attempts to filter text through an external program. Typically, the fmt program included with elvis worked correctly, but the standard MS-DOS sort program didn't. I've spent probably 10 whole days trying to get the Win32 I/O redirection functions to work consistently, and failed. I suspect that Serge has had the same bad luck. Elvis 2.1_3 has a totally rewritten module for running programs, which simply creates a batch file and runs it. If there is filtering to be done, then the batch file redirects stdin and/or stdout to temporary files. This is a kludge, but it seems to work reliably.

    There were a couple of bugs in the "Options->Syntax" menu item. It wasn't always enabled for all syntaxes, and if it was enabled then selecting it would occasionally cause elvis to crash. Both of these should be fixed now.

    Miscellaneous Annoyances
    In filenames, you can now use the backtick notation to run an external program and have its output be parsed as part or all of the filename list. E.g., :n `grep -l sometext *.c`. While I was at it, I added a new shell("command") function which runs an external program and returns its output, so you can do things like :let d=shell("date"). (These features are omitted from the MS-DOS version to help elvis fit in the lower 640k.)

    The :mark command, when invoked without any addresses, will now set the mark to the exact cursor position; previously it was just setting it to the start of the cursor's line.

    I added a :kwic alias, which greps for a given word anywhere in elvis' documentation and builds a table table of all matches, with links to their locations. This gives you yet another way to search through elvis' documentation (in addition to the :howto alias and the :help built-in command). For non-Unix systems, you must find a grep utility somewhere for this to work.

    If your ~/.exrc file contained :set wrapmargin=0 then wrapmargin would be listed by :set, but it shouldn't be. And now it won't be.

    It has been reported that "dead keys" (for entering accented letters) don't work under X11. It appears that my big mistake here was failing to #include <X11/Intrinsics.h>, so elvis' source code didn't know that the multi-character input methods were available. That's fixed, but now the multi-byte input code is being compiled for the first time, and new bugs may turn up.

    If the TERM environment variable is unset and there is no reasonable default, then elvis will use the "open" user interface instead of "termcap". Previously you had to give an explicit "-Gopen" flag to make this happen. The new behavior is more like the traditional vi.

    The markup display modes (html, man, and tex) can now be configured in or out separately, via DISPLAY_HTML, DISPLAY_MAN, and DISPLAY_TEX macros in the config.h file. Previously, there was a single DISPLAY_MARKUP macro which controlled all of them. This change was made mostly so that "tex" could be omitted from the MS-DOS version.

    4. The future of elvis

    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.

    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.

    More colors will be supported. The syntax of the :color command will change to allow you to specify colors and other attributes by the type of text, instead of defining colors by attributes. For example, ":color link=underlined green" will define the appearance of HTML links.

    I intend to add a true extension language to elvis. 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.

    I'm thinking of modifying the markup display modes (man, tex, and html) to store the list of supported markups, and their effects, in a separate file. That way, you could create your own markups to display nroff -ms, RTF, SGML, and MIME "rich text" documents.

    5. Links to related files

    If the main site (ftp.cs.pdx.edu) is too slow, try the mirror site at ftp.false.com.

    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 <Shift-Click>; for MSIE, use <RightClick> and "download".

    untar.c
    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.
    untardos.exe
    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 untardos, run it with no arguments.
    untarw32.exe
    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 untarw32, run it with no arguments, in a text-mode window.

    NOTE: 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 untardos.exe to unpack elvis-2.1-msdos.tar.gz, and untarw32.exe to unpack elvis-2.1-win32.tar.gz.

    untaros2.exe
    This is an OS/2 executable, produced from the above "untar.c" file. For brief instructions on how to use untaros2, run it with no arguments.
    elvis-2.1_3.tar.gz
    This is a gzipped tar archive of the source code and documentation for Elvis 2.1 and its related programs.
    elvis-2.1_3-msdos.tar.gz
    This archive contains the documentation and MS-DOS executables for Elvis 2.1.
    elvis-2.1_3-win32.tar.gz
    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.
    elvis-2.1_3-os2.tar.gz
    This archive contains the documentation and OS/2 executables for Elvis 2.1.
    ftp://ftp.fh-wedel.de/pub/fh-wedel/staff/herbert/elvis/00-index.html
    This is where the OS/2 maintainer stores his most up-to-date versions. It may be better than the elvis-2.1-os2.tar.gz file, above.