-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathpydocstring.txt
208 lines (168 loc) · 4.72 KB
/
pydocstring.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
*pydocstring.txt* Generate Python docstring to your Python code.
Version: 2.3.7
Author: Shinya Ohynagi <sohyanagi@gmail.com>
Repository: http://github.com/heavenshell/vim-pydocstring/
License: BSD, see LICENSE for more details.
==============================================================================
CONTENTS *pydocstring-vim-contents*
Introduction |pydocstring-introduction|
Install |pydocstring-install|
Tutorial |pydocstring-tutorial|
Template |pydocstring-template|
Variables |pydocstring-variables|
==============================================================================
INTRODUCTION *pydocstring-vim-introduction*
|Pydocstring| is a generater of Python docstring.
* Insert one-line docstring.
* Insert multi-line docstring.
This plugin is heavily inspired by phpdoc.vim and sonictemplate.vim.
- phpdoc.vim
http://www.vim.org/scripts/script.php?script_id=1355
- sonictemplate.vim
https://github.com/mattn/sonictemplate-vim
==============================================================================
INSTALL *pydocstring-vim-install*
Install the distributed files into Vim runtime directory which is usually
~/.vim/, or $HOME/vimfiles on Windows.
If you install pathogen that provided from Tim Pope, you should extract the
file into 'bundle' directory.
Pydocstring v2 is support only Vim8 and depends on `doq`.
Install `doq` first.
>
$ make install
>
If you want install `doq` manually, you can install from `PyPi`.
>
$ python3 -m venv ./venv
$ ./venv/bin/pip3 install doq
<
Than set installed `doq` path to |g:pydocstring_doq_path|.
Activated venv needs to be deactivated before insatll doq.
==============================================================================
TUTORIAL *pydocstring-vim-tutorial*
1. def keyword.
Define function to your code.
>
def foo(arg1, arg2):
pass
<
Set cursor on `def` line and type following.
>
:Pydocstring
<
Then docstring put under `def` line.
>
def foo(arg1, arg2):
"""foo.
:param arg1:
:param arg2:
"""
pass
<
2. class keyword.
Define class to your code.
>
class Foo(object):
def foo(self):
pass
def arg1(self, arg1):
pass
<
Set cursor on `class` line and type following.
>
:Pydocstring
<
Then one-line docstring put under `class` line.
>
class Foo(object):
"""Foo."""
def foo(self):
pass
def bar(self, arg1):
pass
<
Set cursor on `def foo` line and type following.
>
:Pydocstring
<
Then one-line docstring put under `def foo` line.
>
class Foo(object):
"""Foo."""
def foo(self):
"""foo."""
pass
def bar(self, arg1):
pass
<
Set cursor on `def bar` line and type following.
>
:Pydocstring
<
Then one-line docstring put under `def bar` line.
>
class Foo(object):
"""Foo."""
def foo(self):
"""foo."""
pass
def bar(self, arg1):
"""bar.
:param arg1:
"""
pass
<
3. Visual select format
>
class Foo(object):
def foo(self):
pass
def bar(self, arg1):
pass
<
Visual select `v3j` and type following
>
:'<,'>Pydocstring
<
Then docstrings put under `class Foo(object):` and `def bar` line.
>
class Foo(object):
"""Foo."""
def foo(self):
"""foo."""
pass
4. Format current buffer
type following
>
:PydocstringFormat
<
Then docstrings will put under class, def keywords.
==============================================================================
TEMPLATE *pydocstring-vim-template*
If you don't like default docstring, You can modify docstring template.
>
let g:pydocstring_templates_path = '/path/to/your/template/directory'
<
You can create custom template.
See `tests/templates' for example.
==============================================================================
VARIABLES *pydocstring-vim-variables*
pydocstring_formatter *g:pydocstring_formatter*
Formatter option.
'sphinx', 'google', 'numpy'
Default value is 'sphinx'
g:pydocstring_templates_path *g:pydocstring_templates_path*
Path to your own template file.
Refer template/pydocstring/ about the default value.
g:pydocstring_doq_path *g:pydocstring_doq_path*
Path to doq command.
Default value is 'lib/doq'
g:pydocstring_enable_mapping *g:pydocstring_enable_mapping*
Disable this option to prevent pydocstring from creating any
key mapping to the `:Pydocstring` command.
Note: this value is overridden if you explicitly create a
mapping in your vimrc, such as if you do:
nmap <silent> <C-m> <Plug>(pydocstring)
Default value is '1'
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0: