O'Reilly logo

Learning the vi Editor, Sixth Edition by Linda Lamb, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.10. Interesting Features

vim is a very featureful editor. We cannot describe everything in full detail here. Instead, we've chosen to discuss several of the most important and unique features that it has.

Automatic file type detection

vim will notice how the lines of a text file end. It sets the fileformat variable to one of dos (CR-LF), unix (LF), or mac (CR) to indicate the file's current mode. By default, vim will write the file back out in the same format, but if you change the value of fileformat, vim will use that convention. This is an easy way to convert between Linux (or UNIX) and MS-DOS files, and makes editing DOS files under UNIX or Linux very easy. (In contrast, the other clones all display a ^M at the end of each line.)

vim is "charityware"

The licensing terms are described later in this chapter; they are fairly liberal. However, the author encourages users who like vim to send a donation to a children's center in Uganda.

Significant C programming extensions

vim has a large set of features for working with C and C++ programs.

The "auto command" facility

vim defines a large number of events, such as before or after reading a file, entering or leaving a window, and so on. For each event, you can set up an "auto command," i.e., a command to be executed when that event occurs.

11.10.1. vim Is Charityware

With vim, Bram Moolenaar has taken a different approach from the usual shareware or freeware author. If you use vim and you like it, Mr. Moolenaar requests ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required