12

I assume the only documentation that comes with Vim is about Vim.

If I install plugins there will be documentation of the plugins as well.

But is there documentation for other languages in Vim?

An example would be, say I am coding in Python in Vim, and want to quickly look up list comprehensions in Python. It would be great if I can just type :h python-doc in Vim and the Python documentation is brought up in Vim documentation.

Other examples would be :h markdown to bring up markdown syntax etc.

Is this kind of thing already on the web? Are there such docs which I can download and :helptags?

5
  • 3
    I don't think this exists, but it could be a really cool plugin.
    – DJMcMayhem
    Oct 15, 2016 at 16:55
  • 2
    Well, I don't know of any, and while this would be cool, it would be also a lot of effort to convert existing documentation to vim-help file. Oct 15, 2016 at 18:15
  • 1
    There are plugins which show the help for the current function while doing autocompletion (like in my question here), but I don't know of any like you describe.
    – muru
    Oct 16, 2016 at 4:32
  • 4
    Take a look at ref. There are many resources for it out there. A partial list of said resources has been compiled in the wiki. You'll need to do some leg work to make full use of it, but you'll never look back.
    – lcd047
    Oct 16, 2016 at 5:43
  • Just want to throw out there that gD can jump to the definition of a function that is defined in standard libraries if you are writing C code. I think that's kind of related to the question. Nov 18, 2016 at 0:13

3 Answers 3

2

Take a look at either

vim-plugin-viewdoc to view help inside vim (it supports a lot of sources and can be extended)

or investigate.vim which can be used to look up documentation in your browser.

For python there is also pydoc.vim.

2

Things somewhat improved since this question was asked. For Python specifically, the keywordprg option is set to python3 -m pydoc in the default file type plugin. It's possible to access Python documentation by simply pressing K on a word for which Python documentation is available.

While this does not utilize :help, it's a very convenient way to access Python's documentation.

The way Vim took was not to use :help to show the documentation of other projects but to use K to search for a keyword - which may be in :help.

See :help 'keywordprg' and :help K for reference.

Doing a quick grep on runtime/ftplugin shows keywordprg is present in the following files (and filetypes):

ruby.vim
readline.vim
modconf.vim
chicken.vim
python.vim
help.vim
sh.vim
octave.vim
ps1.vim
perl.vim
gpg.vim
sudoers.vim
vim.vim
udevrules.vim
sshconfig.vim
dosbatch.vim
erlang.vim
zsh.vim
racket.vim
muttrc.vim
raku.vim
systemd.vim

In vim.vim, it is coincidentally set to :help :-)

1

You can use nvim-devdocs. It brings all the docs in DevDocs into your Vim. You can download any document and use it offline in your Vim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.