In Vim's built-in help system, how do I…
- search for topics that I want help on?
- follow hyperlinks?
- browse around for related material?
In Vim's built-in help system, how do I…
Vim comes with an exhaustive and fully indexed documentation that contains the answers to most of the questions you may have on using Vim.
But the documentation is huge and may look to the neophyte as an impenetrable maze. Here are a few guidelines to help you find what you need…
The :help
command is your gateway to Vim's documentation. Read the first screen now.
:help
Let's go meta:
:help help
You can complete the arguments with <Tab>
and display the list of possible completions with <C-d>
.
:help buf<Tab>
:help :w<C-d>
By the way, here is an explanation of key notation:
:help key-notation
Most Ex commands can be shortened to a few characters. That's true for :help
too:
:h
The :help
command and its tab-completion are case-insensitive so the two commands below will get you to the same section:
:h BufWritePost
:h bufwritepost
Note that a
and A
are both legitimate commands so case-insensitivity doesn't apply.
If you only have a generic keyword to search for, use :helpgrep
and open the quickfix window:
:helpgrep quickfix
:copen
Use <C-]>
on the highlighted words to jump to the corresponding tag, use <C-t>
to come back.
See :help tags
for more.
Scroll around to see if there's a related option or command that better suits your needs. That's a great way to learn new tricks, too.
Use the right syntax to search more efficiently:
:h :command " help for ex-command 'command'
:h 'option' " help for option 'option'
:h function() " help for function 'function'
:h modifier-key " help for 'modifier'-'key' in normal mode
:h mode_modifier-key " help for 'modifier'-'key' in 'mode'
:h mode_modifier-key_modifier-key " help for 'modifier'-'key' 'modifier'-'key' in 'mode'
Examples:
:h :sort
:h 'ai " only one quote needed
:h bufnr( " no need for both parenthesis
:h v_ctrl-g
:h i_ctrl-x_ctrl-o
:h ctrl-w " no mode required for normal mode
Anatomy of a :help
section:
:help ballooneval'
:help options
.:help option-summary
.Use your brain, find logical patterns that will help you for future searches.
Once you have found the handy :help list-functions
, where to look for string-related functions?
Once you have found :help i_ctrl-x_ctrl-o
, how can you find help for <C-x><C-l>
in insert mode?
RTFM is not an insult. You will learn a lot more by reading the documentation than by asking short-sighted questions to random strangers so make sure you at least tried to Read The Fantastic Manual before asking.
:h help-summary
(needs a recent Vim)
Commented
Mar 11, 2016 at 7:05
4. The :help command and its tab-completion are case-insensitive
< ← That's not precisely true: E.g. :h a
and :h A
are distinguished.
Commented
Dec 26, 2016 at 11:00
:helpgrep
can be abbreviated to :helpg
for more efficient everyday usage.
Commented
Dec 27, 2016 at 16:41
:help help
. You also have your answer in the first screen of :help
, which is point #1 of the answer.
-0.1 make notes about vim in a file. Use it as reference and container.
fast way to find vim help of key | :cmd | 'option' | etc
:h gi
or :h g;
for gi or g; in normal mode:h ^i
for Ctrl-i in normal mode:h ^w^w
for Ctrl-wCtrl-w in normal mode:h ^wf
for Ctrl-wf in normal mode:h i^n
for insert mode Ctrl-n:h c^r^r
for cmdline mode Ctrl-r Ctrl-r:h :pu
for ex-command :put
:h 'cb'
for option clipboard
.:h `>
for mark <
.:h @:
for option repeat last ex command by eval register :
(same mechanism as macro).type :h range
, at this time you are in cmdline mode, then:
range
[Command Line]
"*dd
to cut it to system clipboard.[Command Line]
h :range range() <range> [range] :func-range ...
is excerpth mode-Ex mode-replace mode-cmdline mode-switching ...
is excerpt for mode-
.buf
win
tab
line
, etc.cmdline-completion
.-0.2 define a buffer-local key-mapping to invoke vim help of word under cursor, when in previously mentioned vim notes file.
(and possibly with post-processing after extract <cword>
, in a vimscript function)
setl keywordprg=:help
, then K
already works
K
for raw <cword>
, the other one I use is <Space>k
for <cWORD>
with post-precessing. (<Space>
is one of my leader key. Also, to be fluent, 'timeoutlen' being set)
Regarding the question:
how to follow hyperlinks?
With the mouse cursor over the desired link do Ctrl
+ ]
.
Ctrl
+ t
will bring you back to the initial outline with its list of links, where you can then jump to another section via hyperlink.
https://vim.fandom.com/wiki/Learn_to_use_help has a bunch of helpful information that's not accessible (if it's even present) in :h help
.