Getting started on Vim


Ok, so you have decided to start using vim? Great! If you are a vi user, then there is no reason why you shouldn't shift to vim. But if you have never used vi before, then let me warn you : you will need to invest sometime to learn this beautiful program. So depending upon how often you edit text files, make a decision as to whether you really need the power of vim.

Installation

This is the the official Vim download page.

If you are on a Windows system, you can follow this link to download the complete 6.0 distribution. The file downloaded is a self-extracting archive.. First, you need to setup your startup file. The simplest way of doing this is to create a file called .vimrc and place it in the directory pointed by the environment variable HOME or VIM. You can use my .vimrc or Sven's vimrc.

First step : Using tutorials

Some good tutorials on the web are the following. They are vi tutorials (and not vim tutorials), but don't worry : practically everything that applies to vi also applies to vim.

An Introduction to Display Editing with Vi

Mastering the VI editor

Another way of starting is by using the vim tutor that comes along with the vim distribution. Copy the file tutor (located in the subdirectory tutor inside the vim installation directory) into a temporary directory and open it using vim :
        vim tutor
Then follow the instructions given in the tutor. For details, try within vim
:help tutor

One thing to remember is that vim is a lot more intuitive and user-friendly than vi. Vim has file completion (using tabs), command recall (using arrow keys).

Exploiting the power of vim

Once you have got the hang of what vi is all about, you would want to learn how to write macros. Macros are shortcut keys that you setup to help you in your routine editing work. One very nice place to learn writing macros is this.

But to use the true power of vi/vim, you MUST know regular expressions. Regular expressions is a way of describing strings. The regular expressions that all UNIX programs use are mostly similar. Some sites to learn about regular expressions are the following.

Vim regular expressions 101

Geek Talk: The Regular Expression Rundown

So What's A $#!%% Regular Expression, Anyway?!

But all these things are in standard vi and nothing specific to vim. Once you are comfortable with modes and macros, you can start utilizing the infinite advantages of vim. Here is a summary of advantages of vim over vi.

Where to seek help?

Whenever in doubt, you can lookup the vim online help by typing
   :help <subject>
The other place to seek answers to your questions is the Vim FAQ.

If you can't find the answer to your question or are too lazy to search, you can post your question to the vim mailing list. It is an active mailing list and there all kinds of problems discussed. You will however have to subscribe to the mailing list to be able to post. To subscribe, send an email (any body, any subject) to vim-subscribe@vim.org. Once the subscription is confirmed you can send your questions to vim@vim.org. For further details, check this out.

Aziz's vim page Aziz's home