Vim Tips Wiki
(Invoke the vimhelp from the bash command line)
(Insert TipProposed template + minor manual clean)
Line 1: Line 1:
  +
{{TipProposed
Often you only want to look at a specific help page inside vim when your vim is not open.
 
  +
|id=0
I have these 2 functions in my ~/.bashrc to execute this kind of request.
 
  +
|previous=0
  +
|next=0
  +
|created=April 9, 2009
  +
|complexity=basic
  +
|author=Walf
  +
|version=7.0
  +
|subpage=/200904
  +
|category1=
  +
|category2=
  +
}}
  +
Sometimes you may want to start Vim to look at a specific help page. I have these two functions in my <tt>~/.bashrc</tt> for this purpose.
   
to open the help page for the given word from the commandline
+
To open the help page for a given word from the command line:
 
<pre>
 
<pre>
vimhelp ()
+
vimhelp()
 
{
 
{
 
view -c "help $1" -c on -c "au! VimEnter *"
 
view -c "help $1" -c on -c "au! VimEnter *"
Line 10: Line 21:
 
</pre>
 
</pre>
   
and the same with helpgrep (you need the command vim, not view because of the quickfix window)
+
and the same with helpgrep (you need the command Vim, not view because of the quickfix window)
 
<pre>
 
<pre>
vimhelpgrep ()
+
vimhelpgrep()
 
{
 
{
 
vim -c "helpgrep $1" -c on -c copen -c "au! VimEnter *"
 
vim -c "helpgrep $1" -c on -c copen -c "au! VimEnter *"
 
}
 
}
 
</pre>
 
</pre>
Now you can invoke the function with your search and vim opens the desired help page.
+
Now you can invoke the function with your search and Vim opens the desired help page. With the <tt>;vimhelpgrep</tt> function it opens an additional quickfix window and goes to the first hit.
  +
With the "vimhelpgrep" function it opens an additional quickfix-window and goes to the first hit.
 
  +
==Comments==

Revision as of 04:34, 4 May 2009

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