Vi variants

There are a few variations of the basic vi editor that support different features. The most popular is vim, or ``Vi IMproved''. vim adds several important features to vi, including multilevel undo, visual selection, and multiple buffers. It also is fully compatible with the original vi editor. Some machines utilize a version of vim that also contains optional context highlighting, while others provide a separate binary with this feature that is called vimx.

This may seem a little confusing, but it is actually something you don't have to worry about if you just setup your environment to use the version that you prefer on any given system. The easiest way to do this is to add a conditional statement to your login configuration that aliases the ``vi'' command to start whichever version is available. This example illustrates how to do this if you use the tcsh shell. Add the following lines to your ~/.cshrc file:

if ( -X vimx ) then
   alias vi vimx
else if ( -X vim ) then
   alias vi vim
endif

The next time you login to the system, it will alias the vi command to either vimx of vim if they are available. Otherwise the vi command will simply start the original vi editor.