Reputation: 1409
Is there any plugin for Vim that inserts documentation template for each method when coding like docblockr in Atom? I googled it but results are irrelevant.
Upvotes: 3
Views: 1111
Reputation: 12863
I'm only familiar with the Sublime Text DocBlockr, but the Atom DocBlockr is a port of this so they should be functionally the same.
I've found nothing to match the power of DocBlockr after trying numerous failed attempts. I'm using GVim 8.0 on Windows.
vim-jsdoc mentioned by @MisterOccan gets close but it's only for JavaScript. You can set this to request for input (via let g:jsdoc_allow_input_prompt = 1
in your .vimrc
) which allows you to set the values in a similar way to DocBlockr.
For PHP development the best I've found is the updated PDV v2 from TobyS. This combines with the UltiSnips plugin which allows tabbing though the generated doc (via Ctrl+j / Ctrl+k). So this actually gives a relatively close approximation to DocBlockr.
However
@return
values I'm not sure why (just one of the many niggles I've come across)@return
values, but lacks the formatting and the ability to tab through the inputsEdit: You can actually fix the PHP doc block formatting by using the Tabular plugin, with the following command:
:Tabularize /\$\w*/l1
This will match all the $xxx
(\$\w*
) variable names for the @param
lines and pad them appropriately (using left align (l
) with one space (1
)).
Other plugins that I tried:
Upvotes: 1
Reputation: 11
There is no universal plugin for all file types, but a few plugins for specific ft:
e.g
php
.javascript
.EDIT: Another way is to use snippets.
Its always a good idea to search vim plugins in github instead of vim.org.
Upvotes: 1