heavenshell / vim-pydocstring

Generate Python docstring to your Python source code.
BSD 3-Clause "New" or "Revised" License
337 stars 53 forks source link

`noexpandtabs` being set when I call `:Pydocstring`? #103

Closed hoylemd closed 4 years ago

hoylemd commented 4 years ago

Hey folks, I'm getting a lot of use out of the plugin, but I've run into a weird problem. Whenever I call :Pydocstring, the expandtabs setting is switched to noexpandtabs, so it starts inserting filthy heretical tabs into my pure, innocent space-indented python code. How terrible, am I right?!

flippancy aside, It's not a huge issue - I can definitely work around it, but I'm curious as to why it's doing this. It doesn't seem like an intentional thing to me, so I'm thinking it might be a bug (or much more likely, something is weird about my own configuration).

The only hypothesis I have so far is that the help file for it (:help Pydocstring) has a vim modeline at the end with

vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:

I see noet in there, so I wonder if that help file gets sourced when I run the plugin somehow?

Anyways, not an emergency by any means, but more info would be appreciated.

hoylemd commented 4 years ago

I restarted my vim instance and now I can't reproduce it -_-. I know something is causing this behaviour, since Ive found noexpandtabs randomly set many times recently, but now I'm less convinced it has to do with this plugin specifically.

heavenshell commented 4 years ago

Thank you for reporting, but sorry no idea... I did not change any expandtabs settings. only use softtabstop for get current indent number.

It's too less information. When you find out steps to reproduce, please reopen this issue.

BTW vim-pydocstring recommend to use noexpandtabs, because PEP8 recommend use spaces. https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

hoylemd commented 4 years ago

@heavenshell Yeah I think it's specific to my setup in some way. If I do find out why it's happening I'll update here.

re noexpandtabs, I'm a little confused. I thought expandtabs automatically converts tab characters into softtabstop space characters? So I can press my tab key to indent a level instead of pressing spacebar 4 x the indent level. Wouldn't noexpandtabs make it more likely to accidentally use tab characters?

heavenshell commented 4 years ago

@hoylemd ah, sorry you are right. recommend to use expandtab in vim-pydocstring.