Writing long docstrings and long comments is annoying because of the 80-characters width limit.
For example, I write something like:
def fun(self):
"""Return some thing
This function do some complex work and return something that need a
long sentence to describe
"""
And then I found I need to insert something in the third line of docstring. After inserting, the width is much longer than 80 characters, so I manually break it. However, after breaking, the length of forth line is much less than 80, and I have to merge the forth and fifth line, and break it at some proper place so that every line is not too short and too long. If there are more lines, this job gets more annoying.
Similar problem occurs when I found I have to delete something in the third line. Is there any trick, or plugin of PyCharm that deals with this problem? Since I'm using vim plugin in PyCharm, tricks for vim are also great.
To configure the line length, open settings Ctrl+Alt+S , navigate to Editor | Code Style, and type the necessary length in the Hard wrap at N columns field.
Press Ctrl+Alt+S and go to Editor | General |Smart Keys. Select the Insert type placeholders checkbox in the Smart Keys page of the editor settings. Place the caret at the function name, and press Alt+Enter . In the list of intention actions that opens, choose Insert documentation string stub.
Press Ctrl+Alt+S to open the IDE settings and select Editor | General | Smart Keys. In the Enter section, select or clear Insert documentation comment stub checkbox. Then, expand the Smart Keys node and select Python. Use the Insert type placeholders in the documentation comment stub option as required.
Edit -> Fill Paragraph
Merges a paragraph, i.e. a text region without a blank line between.
If you want it to leave text alone you need a blank line between it and the text where the focus is
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With