I have comments that gets balloon (PEP 8: Line too long ... > 120)
I wish there was a command that will wrap the lines with few keystrokes. Right now, even if I type Alt+Enter and press enter on Reformat file
, nothing actually changes. Is there a setting or plugin I could use to accomplish the formatting easily?
Click the Wrapping and Braces tab, and check the "Ensure right margin is not exceeded" checkbox. Now if you select a region of lines and then run the Code/Reformat Code... command, PyCharm will do its best to wrap the comments or code appropriately.
You can enable soft wrap for the editor with ⇧⇧ (macOS), or *Shift+Shift (Windows/Linux), for the Search Everywhere dialogue, and then typing in soft wrap. You can also go to Preferences/Settings > Editor > General to enable Soft Wraps for more file types by default.
Under the Edit
menu, there is a Fill Paragraph
option, which does what I believe you want. You can assign a key command to this in Preferences
, under Appearance & Behavior
-> Keymap
(search for "fill").
Personally, I choose first stroke Esc, second stroke Q, because that's what I've always used in Emacs...
Firstly, reformatting won't work, not in Python at least, where whitespace is important. PyCharm's "Wrap when typing reaches right margin" option is what you're looking for. Now this will not work when you copy and paste code, but in the places where it gives you trouble, just press enter, and it will work.
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