Vim Tips Wiki
Advertisement

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created April 9, 2009 · complexity basic · author Walf · version 7.0

Sometimes you may want to start Vim to look at a specific help page. I have these two functions in my ~/.bashrc for this purpose.

To open the help page for a given word from the command line:

vimhelp()
{
  view -c "help $1" -c on -c "au! VimEnter *"
}

and the same with helpgrep (you need the command Vim, not view because of the quickfix window)

vimhelpgrep()
{
  vim -c "helpgrep $1" -c on -c copen -c "au! VimEnter *"
}

Now you can invoke the function with your search and Vim opens the desired help page. With the ;vimhelpgrep function it opens an additional quickfix window and goes to the first hit.

Comments

Advertisement