This is a plugin to Vim for creating of docstrings.
Docstrings for methods will contain a list of arguments, list of raised exceptions and whether the method yields or raises.
Class docstring will have a list of atributes.
It uses Python's ast library for parsing code. This makes it quite robust solution, which can handle function signature such as
def foo(a='foo(c,d)',
b,
z):
pass
If you use for example Vundle, add Plugin 'pixelneo/vim-python-docstring'
to your .vimrc
file.
Alternatively if you have Vim 8 and newer, you can clone this repository into ~/.vim/pack/<whatever>/start/
where <whatever>
is whatever you want it to be.
The plugin has only commands which you can map however you like (i use <leader>ss
for :Docstring
).
def ...
of class ...
) for which you want to create a docstring:Docstring
or different commandThe plugin uses these commands:
Command | Description |
---|---|
Docstring | Create full docstring |
DocstringLine | Create empty one-line docstring |
There are things you can set.
g:python_indent
optionString which you use to indent your code.
Default: ' '
(4 spaces).
let g:python_indent = ' '
g:python_style
optionWhich docstring style you wish to use.
Default: 'google'
Possible values = ['google'
, 'numpy'
, 'rest'
, 'epytext'
]
let g:python_style = 'google'
Pull requests are welcome as are feature request and issue reports.
You can encounter some situations in which the plugin may not work as expected.
Most notably there may be issues if your keyword for refering to instance is not self
-- in such case it may be added to the list of arguments.
There are more unsolved issues.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。