Vim - Getting help
Vim - Getting Help
Section titled “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.
Accessing the Help Manual
Section titled “Accessing the Help Manual”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.
:helpYou 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.
Help on Specific Topics
Section titled “Help on Specific Topics”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 modesOr 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 ddAnother 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.
Searching the Help Documentation
Section titled “Searching the Help Documentation”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 navigationThis 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.
Accessing Online Help
Section titled “Accessing Online Help”While Vim’s built-in help is excellent, you can also find extensive resources online:
- The official Vim documentation online: https://www.vim.org/docs.php
- The Vim help pages mirrored online: https://vimhelp.org/
- Vim Fandom Wiki: https://vim.fandom.com/wiki/Vim_Tips_Wiki
- Community forums like r/vim on Reddit or Stack Overflow’s Vim section.
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.