Change Vim Keyword Program to ":help" for Vim Files

The default Vim keyword program is “man”. However, when browsing Vim help files, it is more convenient to use Vim’s “help” instead to resolve the “No manual entry for ‘keyword’ problem.””

Just add the following to your .vimrc, so that when a Vim or Vim help file is opened, the local keywordprg is changed to :help automatically.

autocmd FileType help setlocal keywordprg=:help
autocmd FileType vim setlocal keywordprg=:help

Now press Shift+K to jump around help files makes the help experience even better.

With this in mind, we can even assign help programs to other file types and make our life easier, e.g.

autocmd FileType tex setlocal keywordprg=texdoc

And now when a TeX file is opened, hit Shift+K will open texdoc and search for the keywork under the cursor.

View Comments

comments powered by Disqus