I’m using PyCharm on Windows and want to adjust the settings to limit the maximum line length to 79 characters instead of the 120 characters that it now allows.
In PyCharm, where can I alter the maximum number of characters per line?
Asked by Ansuman Bebarta
A screenshot of my Pycharm is shown below. The following path has the necessary settings: Editor -> Code Style -> File -> Settings -> Editor -> Code Style -> Right margin in general (columns)
Answered by Alex G.P.
For PyCharm 2018.1 on Mac, follow these steps:
Editor -> Code Style: Preferences (+,,,,,,,,,,,,,,,,,,,,,,,,,,
For PyCharm 2018.3 on Windows, follow these steps:
File -> Settings (Ctrl+Alt+S), then Editor -> Code Style:
Set Hard wrap at 80 to follow PEP-8.
Answered by lmiguelvargasf
For PyCharm 4
Editor >> Editor >> Editor >> Editor >> Editor >> Editor >> Editor >> Editor >> Editor >> Editor Style of code: right margin (columns)
suggestion: Look at the other choices in that tab; they’re quite useful.
Answered by Marco Sanchez
For HTML, you may even create a separate right margin. Under the following path:
Right margin >> File >> Settings >> Editor >> Code Style >> HTML >> Other Tab >> (columns)
This is incredibly beneficial because HTML and JS are frequently much longer on a single line than Python.
Answered by andy
When doing a code reformat, there is an additional option to check under editor->code style->python: ensure right margin is not exceeded for anyone who is having problems, even myself if I reload my workstation. The reformat would begin after this option was chosen.
Answered by Steve Stacha
Post is based on https://stackoverflow.com/questions/17319422/how-do-i-set-the-maximum-line-length-in-pycharm