Comments (20)
Thank you for request.
Unfortunately, I'm not familiar with Numpy
.
But I add feature_numpy branch.
Note: this is experimental.
Could you try this?
Change template/pydocstring/multi.txt like following.
"""{{_header_}}
{{_arg_}} :{{_lf_}}{{_indent_}} {{_arg_}} is
"""
And then type :Pydocstring
def foo(arg1, arg2):
pass
will generate docstring like following.
def foo(arg1, arg2):
"""foo
arg1:
arg1 is
arg2:
arg2 is
"""
pass
Sorry, pydocstring.vim
can't generate variable type and return value.
You should add them manually.
from vim-pydocstring.
Hi!
Thanks! That's close!
variable type and return value are hard, but is it possible to simply add the "Parameters" and "Returns" strings with the right level of indentation?
from vim-pydocstring.
Hi,
So, you meant like following?
def foo(arg1, arg2):
"""foo
arg1:
arg1 is Parameters
arg2:
arg2 is Parameters
Returns
"""
pass
from vim-pydocstring.
something like that --- basically to generate lines with fixed strings with the right indentation.
def foo(x) :
Parameters
----------------
x : float
x is this stuff.
Returns
-----------
from vim-pydocstring.
Hi, I updated feature_numpy.
Set following template to multi.txt
"""
{{_indent_}}Parameters
{{_indent_}}----------------
{{_arg_}} : vartype{{_lf_}}{{_indent_}} {{_arg_}} is
{{_indent_}}Returns
{{_indent_}}----------------
"""
Results are following.
def foo(x):
"""
Parameters
----------------
x : vartype
x is
Returns
----------------
"""
pass
Thanks.
from vim-pydocstring.
Hey!
That’s pretty much what I want, except for a minor problem that is most likely caused by vim config on my end.
The indentation is sorta screwed up in my MacVim, where eight spaces show up instead of four. Any ideas?
Thanks!
On Dec 6, 2013, at 9:52 PM, heavenshell [email protected] wrote:
Hi, I updated feature_numpy.
Set following template to multi.txt
"""
{{indent}}Parameters
{{indent}}----------------{{arg}} : vartype{{lf}}{{indent}} {{arg}} is
{{indent}}Returns
{{indent}}----------------"""
Results are followingdef foo(x):
"""
Parameters
----------------x : vartype x is Returns ---------------- """ pass
—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
fmm, interesting.
Could you confirm your tab setting?
My .vimrc tab setting is following and works fine for me.
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
from vim-pydocstring.
I pretty much have the same setting as yours, except for the lack of softtabstop which seems irrelevant.
I tried the macro on this test script
def foo(a) :
pass
if True :
def foo(b) :
pass
if True :
def foo(c) :
pass
and the indentation only works for foo(b), but overshoots for the other functions.
On Dec 7, 2013, at 12:56 AM, heavenshell [email protected] wrote:
fmm, interesting.
Could you confirm your tab setting?
My .vimrc tab setting is following and works fine for me.autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
fmm, works fine in my MacVim...
def foo(a):
"""
Parameters
----------------
a : vartype
a is
Returns
----------------
"""
pass
if True:
def bar(b):
"""
Parameters
----------------
b : vartype
b is
Returns
----------------
"""
pass
if True :
def baz(c):
"""
Parameters
----------------
c : vartype
c is
Returns
----------------
"""
pass
Could you show results of following command?
$ vim sample.py
:set tabstop
:set shiftwidth
:set softtabstop
And, could you add debug print to autoload/pydocstring.vim
and show me the result of :message
?
function! pydocstring#insert()
silent! execute 'normal! 0'
let line = getline('.')
let indent = matchstr(line, '^\(\s*\)')
echomsg 'indent:' . len(indent) # <- add this
from vim-pydocstring.
Hi,
I am a bit confused about the debugging message stuff, but the new finding is that,
I have set tabstop to be 4 in vimrc, and it indeed shows up 4 if I open up some non-python files, but when I open a python file the tabstop is then changed to 8. I’m not sure how to track down which plugin did this, but even when I remove all my plugins in my bundle directory the wonky behavior still happens…..
On Dec 7, 2013, at 2:12 AM, heavenshell [email protected] wrote:
function! pydocstring#insert()
silent! execute 'normal! 0'
let line = getline('.')
let indent = matchstr(line, '^(\s*)')
echomsg 'indent:' . len(indent)
from vim-pydocstring.
Hi,
I am a bit confused about the debugging message stuff, but the new finding is that,
Sorry about confusing you:-(
OK, then try :verbose set tabstop
.
This command will track down tabstop set.
from vim-pydocstring.
okay, apparently it was modified by the python.vim plugin that ships with my MacVim (version: 7.4-72) package. I’ve no idea why it changes my tabstop from 4 to 8 though….
On Dec 7, 2013, at 3:52 AM, heavenshell [email protected] wrote:
Hi,
I am a bit confused about the debugging message stuff, but the new finding is that,
Sorry about confusing you:-(
OK, then try :verbose set tabstop.
This command will track down tabstop set.—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
this is what appears in my /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/ftplugin/python.vim file,
" As suggested by PEP8.
setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
this is brutal… ;-(
On Dec 7, 2013, at 3:52 AM, heavenshell [email protected] wrote:
Hi,
I am a bit confused about the debugging message stuff, but the new finding is that,
Sorry about confusing you:-(
OK, then try :verbose set tabstop.
This command will track down tabstop set.—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
according to this, apparently I should stick to tabstop=8 as PEP8 advertised for it….
is it possible to make pydocstring tabstop-agnostic?
On Dec 7, 2013, at 3:57 AM, Ying Zu [email protected] wrote:
this is what appears in my /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/ftplugin/python.vim file,
" As suggested by PEP8.
setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8this is brutal… ;-(
On Dec 7, 2013, at 3:52 AM, heavenshell [email protected] wrote:
Hi,
I am a bit confused about the debugging message stuff, but the new finding is that,
Sorry about confusing you:-(
OK, then try :verbose set tabstop.
This command will track down tabstop set.—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
forgot the link
On Dec 7, 2013, at 4:00 AM, Ying Zu [email protected] wrote:
according to this, apparently I should stick to tabstop=8 as PEP8 advertised for it….
is it possible to make pydocstring tabstop-agnostic?
On Dec 7, 2013, at 3:57 AM, Ying Zu [email protected] wrote:
this is what appears in my /usr/local/Cellar/macvim/7.4-72/MacVim.app/Contents/Resources/vim/runtime/ftplugin/python.vim file,
" As suggested by PEP8.
setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8this is brutal… ;-(
On Dec 7, 2013, at 3:52 AM, heavenshell [email protected] wrote:
Hi,
I am a bit confused about the debugging message stuff, but the new finding is that,
Sorry about confusing you:-(
OK, then try :verbose set tabstop.
This command will track down tabstop set.—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
Nice catch!
OK, how about put follwing vim setting to ~/.vim/after/ftplugin/python.vim
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
from vim-pydocstring.
Added the after/ftplugin/python.vim file with the autocmd line, and :scriptnames reveals that the file was indeed sourced after the system-wide python.vim was sourced. However, still, verbose set tabstop still says it is 8 and was last modified by the aforementioned python.vim file. It seems that the added after-command wasn't correctly parsed....very confusing
from vim-pydocstring.
Oh, sorry it's my fault.
Try following vim setting to ~/.vim/after/ftplugin/python.vim
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
tabstop 8 reproduce indent problem.
I have to consider about this issue.
from vim-pydocstring.
okay, no the indentation works correctly.
However, for functions defined as
def foo(a) :
notice the extra space after the second parenthesis. The script failed to identify “a" as the argument but "a)”.
BTW: I like to leave one extra space because some color scheme requires a separation between colon and keywords for highlighting.
On Dec 7, 2013, at 5:10 AM, heavenshell [email protected] wrote:
Oh, sorry it's my fault.
Try following set to ~/.vim/after/ftplugin/python.vim
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
tabstop 8 reproduce indent problem.
I have to consider about this issue.—
Reply to this email directly or view it on GitHub.
from vim-pydocstring.
Thanks, good to hear that!
I'll look into tabstop indent problem and after issue will solved, I'll merge to master
.
Please wait.
notice the extra space after the second parenthesis. The script failed to identify “a" as the argument but "a)”.
Ah, I reproduced the problem, but this problem is not related to Numpy style docstring issue.
I'll create new issue.
Thank you for improving pydocstring.vim
better.
from vim-pydocstring.
Related Issues (20)
- Custom template not found HOT 2
- `noexpandtabs` being set when I call `:Pydocstring`? HOT 4
- Rerunning PydocstringFormat deletes file contents if docstrings already present HOT 6
- Reuse existing docstring HOT 1
- `:PydocstringFormat` isn't respecting buffer fileformat when outputting results HOT 3
- How to remove the C-L mapping to <Plug>(pydocsgtring) HOT 1
- how can I disable keybinding HOT 1
- Bug: command completion work wrong? HOT 1
- How to get variables returned? HOT 3
- [Question] Pycharm-like behavior? HOT 2
- Error when trying :Pydocstring. HOT 5
- Not an editor command: Pydocstring HOT 7
- Pydocstring overrides C-L shortcut HOT 3
- Add support for class attribute list auto-generation HOT 8
- Only default template format working HOT 3
- Remove default mapping HOT 2
- Generate DocString For All Classes/Functions HOT 3
- Can't get it working with neovim HOT 4
- `doq` not found. Install `doq` HOT 4
- command not added to vim HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-pydocstring.