January 31, 2006

Review: vile editor is anything but

Author: Mayank Sharma

If you code or play with configuration files in Linux, chances are the editor you use is either vi or Emacs. While most people agree that vi is a hacker's tool and Emacs is more of a text editor, flame wars between the two camps aren't uncommon. vile, which stands for "vi like emacs," attempts to bring together the best of both worlds.

vi and Emacs are both full-function editors that you can extend with macros, but both have drawbacks. New users in particular find it difficult to get started with vi. You can't even enter text in vi without knowledge of its three modes and a handful of other commands. Emacs is modeless and thus friendlier for first-time users, but it's not nearly as fast as vi for editing and moving around in files.

vi has several clones, such as calvin, Elvis, nvi, viper, and Vim, but vile isn't another vi clone, according to its maintainer, Thomas Dickey. It has the most common vi commands, but doesn't look quite like vi. vile is an editor that works and feels like vi but, like Emacs, incorporates features for editing multiple files in multiple windows.

Surprisingly, vile grew out of MicroEMACS, whose author, Dave Conroy, didn't like the fully loaded Emacs. vile's current maintainer, Thomas Dickey, joined the project in 1992 after having been a vi user for almost 10 years.

Installing vile

vile is a small utility and painless to install. ./configure, make, and make install get you a working vile editor. Depending upon your distribution, you may also find binary install packages. For instance, if you're using Ubuntu, sudo apt-get install vile xvile vile-common vile-filters should get you both vile and xvile, a version with excellent X Window System support.

You need to let the compiler know if you want to use syntax highlighting. The command ./configure --with-screen=x11 --with-builtin-filters configures xvile and enables syntax coloring. ./configure --with-screen=x11 --with-builtin-filters="awk html c pl py" enables syntax coloring for AWK, HTML, C, Perl, and Python. For more options, read through the doc/config.doc file after exploring the vile source tarball.

Using [x]vile

The vile editors use their own startup files, whose location and name depend upon the method of installation. Try looking under the home directory for .vilerc if you compiled vile by hand. After performing an apt-get installation of vile under Ubuntu, I found the vileinit.rc under /usr/share/vile.

The xvile editor looks a tad more graphical than the vanilla vile editor. Both feature the Emacs-inspired information bar at the bottom, and xvile includes a toolbar on top for easier access to common tasks.

A vi user should have no problems getting started on the vile editors. In contrast to other vi implementations, even new users won't have to look around much -- Help -> General gets you started almost immediately. The editors also feature a few built-in commands that you'll find useful. :show-commands brings up a window that lists all commands alphabetically and includes a brief description of each. In case you forget which key does what, :describe-key prompts for a key and prints the function associated with it along with a brief description of that function.

As in Emacs, you can browse through directory listings and call up files you want to edit. Don't feel like typing that long command you used yesterday? Use the :show-history command, which splits the screen into two and dumps the contents of the [history] buffer (which stores all your commands) in a new window.

The :split command creates a new window. All windows share the same bottom line for the execution of commands but have separate status lines. The status line in the active window is filled with the equal (=) sign. Use :next-window and :previous-window to jump between windows. Ctr-K closes the active window.

vile uses the undolimit option in its configuration file to control how many changes it remembers. set undolimit=100 means you can undo the 100 most recent changes, whereas set undolimit=0 allows for an infinite undo. Vile is different from vim and uses the q quote command to select an area. For example, d2qjjq deletes (d) the lines (2q-q) selected by the motion (jj).

Take a look at the help file for a lowdown on the differences between vile and other popular vi clones. Brian Moore's Web page, designed using vile, has a nice collection of tutorials to get you started.


vile is a cross between an easy-to-use vi and a best-of Emacs. It scores points over Vim, one of the most popular clones of vi, because it's slimmer and yet manages to pack in all the essentials, along with functionality and features not found in most vi clones.

Click Here!