History Report a problem
Article Edit this page Discussion

Learn to use help

From Vim Tips Wiki

Jump to: navigation, search

Tip 882 Previous TipNext Tip

Created: February 21, 2005 Complexity: basic Author: David S Minimum version: 5.7 Karma: 33/25 Imported from: Tip#882


Vim's help is remarkably thorough, but it definitely takes some getting used to if you are new to it.

Starting out, remember:

  • Get specific help by browsing with :help or by jumping to a topic with :help <topic>
  • After typing your help search, CTRL-D will list all matches to your subject so that you can narrow what you are looking for. For example, :help scroll<C-D>. Use <TAB> to scroll.
  • You can search through all the help files with the :helpgrep command.
  • You can search within a single help file just like within a regular file using /.
  • :help quickref is a good place to start.
  • CTRL-] follows a link, and CTRL-T goes back.
  • Read a new chapter from the main help (:help) file every now and again to learn something new!

[edit] References

[edit] See also

[edit] Vim built-in help

 TO DO 

  • Merge in following info from deleted tips 179, 229, 326

Vim built-in help is the fastest way to get info, once you know what to look for. You can try this command to show a list of related topics:

:h <topic><c-d>

It is "some topic" followed by the key sequence Ctrl-D. For eg:

:h xterm<c-d>

will show all the help topics matching xterm. Then you can do completion/copy-n-paste the topic you are searching. Of course you can cycle through all the topics through repeated <TABS>, but if the number of hits are huge, it is cumbersome.

You can also use this command:

:helpgrep {pattern}

to search all the help files for a pattern.

BTW, <c-d> can be used for listing other matches also. For example:

:e <c-d> "to show list of files matching the pattern
:buf <c-d> "to show list of open buffers etc.

See :help quickref for a Vim Command Quick Reference Page – brilliant for beginners and oldtimers alike.

[edit] Other Help Tips

:h visual<C-D><tab> : obtain list of all visual help topics
    : Press Tab to step through them.
:h ctrl<C-D> : list help of all control keys
:h :r : help for :ex command
:h CTRL-R : normal mode
:h \r : what's \r in a regexp
:h i_CTRL-R : help for say <C-R> in insert mode
:h c_CTRL-R : help for say <C-R> in command mode
:h v_CTRL-V : visual mode
:h tutor : Vim Tutor
gvim -h : command line

[edit] Simplify help navigation

Vim help has hyperlink support - you can press <C-]> over |some subject| or 'some option' to read more about particular term. Return with Ctrl-T.

The following mappings simplify help buffer navigation:

  • pressing s(or S) will find next(previous) subject from cursor position
  • pressing o(or O) will find next(previous) option from cursor position
  • pressing Enter will jump to subject under cursor
  • pressing Backspace will return from the last jump

Put them into help filetype plugin (like ~/.vim/ftplugin/help.vim on Unix).

nmap <buffer> <CR> <C-]>
nmap <buffer> <BS> <C-T>
nmap <buffer> o /'[a-z]\{2,\}'<CR>
nmap <buffer> O ?'[a-z]\{2,\}'<CR>
nmap <buffer> s /\|\S\+\|<CR>
nmap <buffer> S ?\|\S\+\|<CR>

[edit] Comments

Also see the wildmenu. My settings:

set wildmenu wildmode=longest:full,full

What it does:

  • First tab: longest match, list in the statusbar.
  • Next tabs: cycle through matches. (Like in the shell)

In addition to C-] and C-T, C-O and C-I can be used to jump backward and forward in the jump list history.

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Astronomy Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for featured Wikia!

Send this article to a friend
"Learn to use help"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation