Vim has three methods of looking up help:
- :help keyword
- Look up keyword (supports partial matches and tab completion).
- Good if you know what you're looking for.
- :helpgrep query
- Grep all help for specific text query.
- Good if you don't know what you're looking for.
- K
- Look up help for the text under the cursor.
- Only meaningful when editing vimscript.
- tpope's vim-scriptease has an improved
K
that figures out the type of command from the context (to differentiate :call
from call()
).
In this case, we know part of the command so we can use :help
. But what keyword do we use?
Tab completion with the right prefixes makes it pretty quick to find what you're looking for if you already know something about the command:
:
is used for cmdline/Ex-mode commands
- Example:
:help :help
- These are input at the bottom of the screen. See
:help :
'
is used for options
- Example:
:help 'incsearch'
- These are vim settings applied with
:set
. See :help :set
and :help option-list
.
- No prefix for normal mode commands
- Example:
:help CTRL-]
- See
:help Normal-mode
i_
for insert mode
- Example:
:help i_CTRL-[
- See
:help Insert-mode
v_
for visual mode
- Example:
:help v_CTRL-]
- See
:help Visual-mode
Vim command names almost always end at punctuation (non-word characters).
If we enter in the sequence of commands, we'll see that v/layout
is typed in from the cmdline (input at bottom of screen). That means we need to include the colon. We'll ignore /layout
since punctuation terminates the command name.
:help :v
Vim will give you the abbreviated name for the command and information about using it. In this case, it mentions that :v is "Same as :g!", so we can scroll up to look for :g! (:global).
In short, Vim help has everything you need: :help help-summary
has the above information and more new user tips.