Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make PyCharm's Fill Paragraph command override the default margin?

PyCharm has a great Fill Paragraph command, the only problem is that it wraps to the right margin setting. The problem with this is that it doesn't follow PEP8. I want to set my right margin to 79 to follow PEP8, but I want my comment blocks to be 72 characters, as PEP8 specifies. When I run the Fill Paragraph command I want it to wrap to 72 characters, not to 79. If it's not possible to do in PyCharm then I'll probably just not follow PEP8 this strictly; it's not worth taking the time to manually fix up the line length of comments in my opinion, 79 will have to do.

References:

http://legacy.python.org/dev/peps/pep-0008/

like image 546
Samuel Avatar asked Nov 07 '14 19:11

Samuel


2 Answers

I found feature-request about it: https://youtrack.jetbrains.com/issue/PY-15700 in PyCharm bug tracker. You need to vote for it to increase its priority and be notified about updates.

like image 174
PyTony Avatar answered Oct 04 '22 19:10

PyTony


Check out this plugin:

https://github.com/abrookins/WrapToColumn

This allows you to set a custom line-width for wrapping. So setting that to 72 and running the wrapper on the docstring works quite nicely!

like image 31
tiam Avatar answered Oct 04 '22 20:10

tiam