3. Vim's built in help

Learning the way the help system system works in any application you use is always a good idea. In vim, it isn't just a good idea, it's essential. When I first started using vim I put it off for the longest time. I wish I wouldn't have done that!

3.1. Tutor me!

Thanks to vim's hard working developers vim has a very extensive built-in help system. As part of their work they developed a tutor which will walk you through the basics.

To start the tutor simply type this command at the console:

bash$ vimtutor

Vim should start and look something like this:

===============================================================================
=    W e l c o m e   t o   t h e   V I M   T u t o r    -    Version 1.4      =
===============================================================================

Vim is a very powerful editor that has many commands, too many to
explain in a tutor such as this.  This tutor is designed to describe
enough of the commands that you will be able to easily use Vim as
an all-purpose editor.

The approximate time required to complete the tutor is 25-30 minutes,
depending upon how much time is spent with experimentation.

The commands in the lessons will modify the text.  Make a copy of this
file to practice on (if you started "vimtutor" this is already a copy).

It is important to remember that this tutor is set up to teach by
use.  That means that you need to execute the commands to learn them
properly.  If you only read the text, you will forget the commands!

Now, make sure that your Shift-Lock key is NOT depressed and press
the   j   key enough times to move the cursor so that Lesson 1.1
completely fills the screen.

Simply follow along with the tutor. Below is the outline of what the tutor covers in case you are already familiar with vim. I recommend you continue using the tutor until you can complete it "out of sequence." In other words, you ought to be able to jump around throughout the tutor, doing sections at random, before continuing with the rest of this document.

  1. Moving the cursor

    1. Entering and exiting vim

    2. Text editing-deletion

    3. Text editing-insertion

  2. Deletion commands

    1. More deletion commands

    2. On commands and objects

    3. Exceptions to command-object

    4. The undo command

  3. The put command

    1. the replace command

    2. The change command

    3. More changes using "c"

  4. Location and file status

    1. The search command

    2. Matching parentheses search

    3. A way to change errors

  5. How to execute an external command

    1. More on writing files

    2. A selective write command

    3. Retrieving and merging files

  6. The open command

    1. The append command

    2. Another version of replace

    3. Set option

  7. Online help commands

3.2. Navigating vim's help

Vim has an extensive help system. The most basic command is:

:help

This command will take you to vim's help text. Throughout the help files you will see tags like this: |bars|. By positioning your cursor over these tags and hitting CTRL-] you can jump directly to the subject. To get back to your original position simply type CTRL-t.

Tip

You can quit the help window by typing :q.

A variation of the above command is this:

:help subject

Where subject is the information you are looking for. One thing to note about the above command is that it takes you to the subject reference. What this means is that this type of help is aimed at users who are already familiar with vim's help syntax. The vimtutor command in the Tutor me! section covers this in Lesson 2 of the vimtutor. You did do the vimtutor didn't you?

Tip

You can also access vim's help by pressing the F1 function key.

Vim's help also contains some quick reference links which you can locate by typing:

:help quickref

If you're looking for less terse explanations a good place to start is with the vim introduction. In addition to the introduction you can find more detailed help with this command:

:help doc-file-list