Reputation: 11916
Many vim blog posts will give a series of vim commands, but don't explain all of the details. How can a new user use vim's help to figure out how it works?
For example, here's a command from this blog post:
ggjV/---<cr>k:v/layout:\|title:/d<cr>
I recognize that /layout:\|title:/
is a regex, but how can I find out what v/regex/d does?
Upvotes: 3
Views: 2146
Reputation: 11916
Vim has three methods of looking up help:
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
:help :help
:help :
'
is used for options
:help 'incsearch'
:set
. See :help :set
and :help option-list
.:help CTRL-]
:help Normal-mode
i_
for insert mode
:help i_CTRL-[
:help Insert-mode
v_
for visual mode
:help v_CTRL-]
: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.
Upvotes: 6