Setting Up Vim

Introduction

If you are using any of the standard Linux distributions, you probably already have a version of vim already installed on your system. If you want to get the most-current version, either for Unix/Linux or for Windows, go to the Vim web site and follow the directions there for downloading and installing the editor.

Adjust your .vimrc file

The installation program normally puts a file named .vimrc in your home directory. On Windows, the file will be named _vimrc, and will be in the directory where Vim was installed. For example, when I installed version 6.1, it was placed in D:\Utils\Vim\vim61, and the _vimrc file was put in D:\Utils\Vim. Also, the Windows environment variable, VIM, was set to D:\Utils\Vim.

The standard .vimrc file supplied with the Vim distribution is not quite correct for use in this course. You need to set the tab width to something small, you must set the option to replace tabs with spaces, and you need to tell vim to wrap lines longer than 72 characters. I also have some keyboard shortcuts that I like to use, mostly so I can enter certain commands while I am in insert mode. Here are links to two .vimrc files, one for Windows and one for Unix that you may use as a model for your own. Feel free to modify them as you wish, but be sure not to change the expandtab and tw options!

Reference Material

There are lots of tutorials on vi and vim on the Web. One site that's very good is Dr. Chip's Vim Page. There's also a big book on Vim, Vi IMproved -- Vim by Steve Oualline published in 2001 by New Riders Press (ISBN 0-7357-1001-5). (That's not a typo; the author's last name starts with 'O' not 'Q').