home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Learning the vi Editor

Learning the vi EditorSearch this book
Previous: II. Extensions and Clones Chapter 8 Next: 8.2 Multiwindow Editing
 

8. vi Clones Feature Summary

8.1 And These Are My Brothers, Darrell, Darrell, and Darrell

There are a number of freely available "clones" of the vi editor. Appendix E, vi and the Internet , provides a pointer to a web site that lists all known vi clones. We have chosen to cover four of the most popular ones. They are:

  • Version 1.79 of Keith Bostic's nvi

  • Version 2.0 of Steve Kirkendall's elvis

  • Version 5.0 of Bram Moolenaar's vim

  • Version 7.4 of vile , by Kevin Buettner, Tom Dickey, and Paul Fox

The clones were written because the source code for vi is not freely available, making it impossible to either port vi to a non-UNIX environment or to study the code, and/or because UNIX vi (or another clone!) did not provide desired functionality. For example, UNIX vi often has limits on the maximum length of a line, and it cannot edit binary files. (The chapters on the various programs present more information about each one's history.)

Each program provides a large number of extensions to UNIX vi ; often, several of the clones provide the same extensions, although usually not in an identical way. Instead of repeating the treatment of each common feature in each program's chapter, we have centralized the discussion here. You can think of this chapter as presenting "what the clones do," with each clone's chapter presenting "how the clone does it."

This chapter covers the following topics:

Multiwindow editing

This is the ability to split the screen into multiple "windows."[1 ] You can edit a different file in each window, or have several views into the same file. This is perhaps the single most important extension over regular vi .

[1] Note that these are not the windows that you find on X Window-based UNIX workstations, or under MS-Windows or the Apple Macintosh.

GUI interfaces

All of the clones except nvi can be compiled to support an X Window interface. If you have a system running X, use of the GUI version may be preferable to splitting the screen of an xterm (or other terminal emulator); the GUI versions generally provide such nice features as scrollbars and multiple fonts. The native GUIs of other operating systems may also be supported.

Extended regular expressions

All of the clones make it possible to match text using regular expressions that are similar or identical to those provided by the UNIX egrep (1) command.

Enhanced tags

As described in Section 7.5.3, "Using Tags" in Chapter 7 in Chapter 7, Advanced Editing , you can use the ctags program to build up a searchable database of your files. The clones make it possible to "stack" tags, by saving your current location when you do a tag search. You can then return to that location. Multiple locations can be saved in a Last In First Out (LIFO) order, producing a stack of locations.

Several of the vi clone authors and the author of at least one ctags clone have gotten together to define a standard form for an enhanced version of the ctags format. In particular, it is now easier to use the tags functionality with programs written in C++, which allows overloaded function names.

Improved editing facilities

All of the clones provide the ability to edit the ex command line, "infinite undo" capability, arbitrary length lines and eight-bit data, incremental searching, (at least an option) to scroll the screen left to right for long lines instead of wrapping long lines, and mode indicators, as well as other features.

Programming assistance

Several of the editors provide features that allow you to stay within the editor during the typical "edit-compile-debug" cycle of software development.

Syntax highlighting

In elvis , vim , and vile , you can arrange to display different parts of a file in different colors and/or fonts. This is particularly useful for editing program source code.

There is one additional feature in the clones that we have chosen not to cover: extension languages. As of May 1998, nvi has preliminary support for Perl and Tcl integration, elvis has its own C-like expression evaluator,[2 ] vim has a C-like expression evaluator, plus support for Perl, Python, and Tcl integration, and vile , which has always had its own built-in extension language, has preliminary support for Perl integration. The extension language integration and support are very recent for all of the programs and will undoubtedly change significantly. For this reason, any discussion of the extension language facilities would be obsolete almost as soon as this book goes to press.

[2] The elvis 2.0 documentation mentions that "someday" elvis will have a true extension language, most likely Perl, but probably not for version 2.1. Steve Kirkendall doesn't really consider the expression evaluator to be an extension language.

We recommend that you check the online documentation for your clone if you're interested in programming your editor with an extension language.[3 ] Extension languages are a feature worth watching; they promise to bring a new dimension of power to vi users. The use of well-known programming languages, such as Perl, Python, and Tcl, is an additional advantage, since it is likely that users will already know one or more of them.

[3] emacs users have been doing this since the beginning; it is one of the reasons that many are rather fanatic about their editor.


Previous: II. Extensions and Clones Learning the vi Editor Next: 8.2 Multiwindow Editing
II. Extensions and Clones Book Index 8.2 Multiwindow Editing

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System