Wikia

Vim Tips Wiki

Fast help in full window

Talk0
1,610pages on
this wiki
Revision as of 10:56, July 27, 2009 by JohnBeckett (Talk | contribs)

Tip 265 Printable Monobook Previous Next

created June 22, 2002 · complexity basic · author Mikolaj Machowski · version 6.0


You can get fast access to read Vim's help by writing a small script. This can be particularly helpful if you have written your own documentation using Vim's help file type.

Suggestion 1

#!/bin/bash
vim -c "help $1" -c only

Now name it, for example, vih and from the command line:

$ vih makeprg

Suggestion 2

Make an alias or shortcut to the command:

gvim -c ":h MyKeyWord" -c :only

This will open gvim, jump to your help text in help mode and close all the rest. You only see your help text, just what you wanted to read.

From 200904 tip (now removed)

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.

 TO DO 

  • The two commands above include "au! VimEnter *" which removes all VimEnter autocommands.
  • That is probably to remove the effect of something in the author's vimrc, but is not required in general.
  • Think about whether to remove it, or perhaps replace with something like:
view -u '$VIMRUNTIME/vimrc_example.vim' -c "help $1" -c only

See also

These tips attempt to deal with making your own help text:

These tips relate to using vim -c:

Comments

Around Wikia's network

Random Wiki