Skip to content

Vim - Getting help

Vim is a feature-rich editor, and remembering every command can be challenging. Fortunately, Vim provides comprehensive built-in help documentation.

In this chapter, we will discuss how to:

  • Access the general help manual.
  • Get help on specific topics or commands.
  • Search for keywords within the help documentation.
  • Find online resources.

The primary way to access Vim’s extensive help system is with the :help command. This command opens the main help file in a new horizontal split window, allowing you to read documentation without closing your current file.

:help

You can navigate the help window just like any other Vim buffer (e.g., using j, k, Ctrl+f, Ctrl+b). Help topics are often linked; place your cursor on a tag (highlighted text, e.g., |tags|) and press Ctrl+] to jump to that topic. Use Ctrl+t to jump back.

If you know the name of a command, option, or topic, you can get specific help for it:

:help <topic-name>

Replace <topic-name> with the item you’re interested in. For example, to get help on Vim’s different modes:

:help modes

Or for help on the number option:

:help 'number'

You can also get help for Normal mode commands. For instance, to get help on the dd command:

:help dd

Another useful trick in Normal mode is to press K (uppercase K) with your cursor on a command or keyword. Vim will try to look up documentation for that word.

If you don’t know the exact topic name, you can search all help files for a phrase using :helpgrep:

:helpgrep <phrase>

For instance, to search for help related to navigation:

:helpgrep navigation

This command populates the quickfix list (or location list) with matches. You can open the list with :copen (or :lopen) and navigate through the results. Use :cn to go to the next match and :cp to go to the previous match.

While Vim’s built-in help is excellent, you can also find extensive resources online:

Practical Application: When you’re unsure how a command works or want to discover new features, the built-in :help is your best first resource. It’s fast, comprehensive, and available offline.