vimtricks.wiki Concise Vim tricks, one at a time.

How do I search across all Vim help files for a keyword or phrase?

Answer

:helpgrep

Explanation

:helpgrep {pattern} searches all installed Vim help files for a pattern and populates the quickfix list with every match. It is far more powerful than :help when you know roughly what you are looking for but not the exact help tag name.

How it works

  • :helpgrep {pattern} — search all help files, populate quickfix list
  • :copen — open the quickfix window to browse results
  • :cnext / :cprev — navigate between matches
  • The pattern is a standard Vim regex, so you can use anchors, alternation, etc.

Example

Search for every mention of autocmd across all help docs:

:helpgrep autocmd
:copen

The quickfix list shows each match with file, line, and context. Press <CR> on any entry to jump to that help topic.

Search with a regex to find help about expression registers:

:helpgrep expression.*register

Tips

  • :lhelpgrep is the location-list variant, which keeps each window's results separate
  • Results persist until the next :helpgrep or :vimgrep run, so use :colder / :cnewer to recall previous search results
  • Combine with :cfdo to perform bulk operations on matched help entries

Next

How do I make Vim always open new splits below and to the right instead of above and to the left?