Wikia

Vim Tips Wiki

Fast help in full window

Talk0
1,613pages on
this wiki
Revision as of 05:21, July 13, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Tip 265 Printable Monobook Previous Next

created 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 1Edit

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

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

$ vih makeprg

Suggestion 2Edit

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)Edit

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 alsoEdit

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

These tips relate to using vim -c:

CommentsEdit

Around Wikia's network

Random Wiki