Fast help in full window
From Vim Tips Wiki
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.
Contents |
[edit] Suggestion 1
#!/bin/bash vim -c "help $1" -c only
Now name it, for example, vih and from the command line:
$ vih makeprg
[edit] 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.
[edit] 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
[edit] See also
These tips attempt to deal with making your own help text:
These tips relate to using vim -c:
- 36 Using Gnu-info help in vim
- 167 Using vim as a man-page viewer under Unix
- 265 Fast help in full window
- 745 Find VIMRUNTIME in a bash script
- 816 JAVH - Just another Vim Hacker
- 1338 See man pages by gview